SELECT Address_1, Address_2,Address_3 ,Address_4,
ISNULL(Address_1,'') ' ' ISNULL(Address_3,'') ' ' ISNULL(Address_2,'') ISNULL(Address_4,'') AS Full_Address
FROM landing_doctor_det
--------------------------------------
select clinic_institute_name,doctor_Name,Mobile_1,Address_1,category,City,specilisation,State,email_id
from landing_doctor_det where
clinic_institute_name is not null and doctor_Name is not null AND Mobile_1 is not null AND Address_1 is not null and
category is not null AND City is not null AND
(specilisation is not null or State is not null or email_id is not null)
my main query is the second query. I want to add the column in the second query which i am getting after executing the first query(Full_Address)
CodePudding user response:
You can simply select all columns in one statement, like this:
SELECT
clinic_institute_name,
doctor_Name,
Mobile_1,
Address_1,
category,
City,
specilisation,
State,
email_id,
Address_1,
Address_2,
Address_3,
Address_4,
ISNULL(Address_1, '')
' ' ISNULL(Address_3, '')
' ' ISNULL(Address_2, '')
ISNULL(Address_4,'') AS Full_Address
FROM landing_doctor_det
WHERE clinic_institute_name IS NOT NULLL
AND and doctor_Name IS NOT NULL
AND Mobile_1 IS NOT NULL
AND Address_1 IS NOT NULL
AND category IS NOT NULL
AND City IS NOT NULL
AND (
specilisation IS NOT NULL
OR State IS NOT NULL
OR email_id IS NOT NULL
)