swapna.anu
Starting Member
3 Posts |
Posted - 2012-04-04 : 05:39:29
|
Hi All,I am trying to write a sql query using sql server 2000. My query and the result set looks like belowselect h.UPRN, h.address1 as fulladdress, h.jobid, h.engineername, l.make as boilermake, l.model as boilermodel, l.locationcode, l.apptype, h.tightness, h.emergency as emergencycontrols, l.serialno, l.cp12labwarn from tblcp12_lines l join tblcp12_headers h on h.jobid = l.jobid where h.jobid = '700936' and isnull(CP12Status,'') <> 'Removed' and isnull(CP12Details,'') <> 'NO GAS FOUND IN PROPERTY.' UPRN fulladdress jobid EngineerName Boilermake BoilerModel locationcode apptype tightness emergencycontrols serialno cp12labwarn6224156 52, Ridgeview Close 700936 Jonathan Afshin NEW WORLD UNK KITCHEN COOKER Pass Yes UNKNOWN NULL 6224156 52, Ridgeview Close 700936 Jonathan Afshin POTTERTON PROFILE 50E COMPARTMENT BOILER Pass Yes UNKNOWN No 6224156 52, Ridgeview Close 700936 Jonathan Afshin UNKNOWN UNK FRONT ROOM GAS FIRE Pass Yes UNKNOWN No 6224156 52, Ridgeview Close 700936 Jonathan Afshin CARBON MONOXIDE DETETOR FIREANGEL BEDROOM Carbon Monoxide dete Pass Yes UNKNOWN NULL 6224156 52, Ridgeview Close 700936 Jonathan Afshin UNKNOWN UNK HALL Smoke detector Pass Yes UNKNOWN NULLI want to change it to return in a single row which should have all the details similar to the line in apptype as Boilder and along with that i need to get other appliance types like below6224156 , 52,Ridgeview Close, 700936, Jonathan Afshin, Potterton, Profile 50E, Compartment, Boiler, Cooker, Gas Fire, Carbon Monoxide dete, Pass , Yes, No (This is cp12labwarn which should be No if any one of the rows contains No otherwise Null)Please do let me know if you need more details to get this results.I am using SQL Server 2000.Thanks in advance |
|