SELECT TOP (100) PERCENT CONVERT(VARCHAR(36), accountid) AS Accountid, name AS BusinessName, address1_line1, address1_line2, address1_line3, address1_city,
address1_county, address1_postalcode, emailaddress1, fax, new_aftercareflag, new_businessadvisorifpsybtidname, new_businessadvsoridname,
new_businessdescription, new_numberoffulltimejobs, new_numberofparttimejobs, new_region, new_regionname, websiteurl, telephone1, statuscode,
new_businessclassificationcode, new_businessclassificationcodename, new_businessstatus, new_businessstatusname
FROM dbo.FilteredAccount
WHERE (new_businessstatus = 2) AND (new_businessdirectory = 1) AND (statuscode = 1) AND (new_clientbusiness = 1) OR
(new_businessdirectory IS NULL) AND (statuscode = 1) AND (new_aftercareflag = 1) OR
(new_businessdirectory = 1) AND (statuscode = 1) AND (new_aftercareflag = 1)
ORDER BY LEN(new_businessdescription) DESC
|