Amarnath Posted August 5, 2009 Share Posted August 5, 2009 Hi Good Morning Friends..Help me...I'm using sql server 2005 management studio... SELECT *FROM(SELECT z.zone_id AS Zones,z.zone_name AS ZoneName,count(c.circle_id) AS Circles,count(c.trans_id) AS Transfer,sum(c.housescovered) AS HousesCover,sum(c.housesnotcovered) AS HousesnotCover FROM zone_mas z INNER JOIN circle_mas c ON z.zone_id=c.zone_id GROUP BY z.zone_id,z.zone_name) aINNER JOIN(SELECT z.zone_id, count(distinct s.loc_id) AS Locations,count(distinct s.veh_no) AS Vehicles,sum(s.bin_no) AS Bins FROM Zone_mas z LEFT JOIN schedule_mas s on s.zone_id=z.zone_id GROUP BY z.zone_id,z.zone_name) bON a.Zones = b.zone_id the solution is like this.....CZ Central Zone 4 4 0 0 CZ 0 0 NULLEZ East Zone 3 3 123177 17578 EZ 185 8 132NZ North Zone 4 4 0 0 NZ 0 0 NULLSZ South Zone 3 3 0 0 SZ 0 0 NULLWZ West Zone 4 4 151534 6620 WZ 0 0 NULLmy probelm is that i don't want to print the bolded column again because it is at first..I'm using this code to run in phpexecuting in php and by executing i need to store the result and print...CZ Central Zone 4 4 0 0 0 0 NULLEZ East Zone 3 3 123177 17578 185 8 132NZ North Zone 4 4 0 0 0 0 NULLSZ South Zone 3 3 0 0 0 0 NULLWZ West Zone 4 4 151534 6620 0 0 NULLI want the output like this...can u give me information that can we handle output columns... to print...Thanks In Advance... Link to comment Share on other sites More sharing options...
justsomeguy Posted August 5, 2009 Share Posted August 5, 2009 How about you just don't select the column twice? Why do you need to select the column twice? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.