Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
vani
Starting Member
1 Post |
Posted - 2005-10-25 : 23:34:49
|
| hi all,can anybody help in combining all the mentioned queries into a single query so as to display all fields in a row.1.number of imported imported animal type:select count(*) as import_lic_no from appln_clip ac,consign_animal c,pet pwhere ac.ac_id=c.ac_id and p.pet_no=ac.clip_id and ac.appln_id like 'A8%'2. number of imported animal type that are licensed:select count(*) as lic_imp_ani_type from pet p,clip c where p.pet_no=c.clip_id3.percentage: 2/1*100select percentage=((select count(*) as lic_imp_ani_type from pet p,clip c where p.pet_no=c.clip_id)(select count(*) as lic_imp_ani_type from pet p,clip c where p.pet_no=c.clip_id))*1004.local animal type:total pet records - 1select number=(select count(*) from pet p) - (select count(*) from appln_clip ac,consign_animal c where ac.ac_id=c.ac_id)5.local animal type that are licenced:total pet records-2select number1=(select count(*) from pet p) - (select count(*) from pet p,clip c where p.pet_no=c.clip_id)6.percentage: 5/4*100select percentage=((select count(*) from pet p) - (select count(*) from pet p,clip c where p.pet_no=c.clip_id)/(select count(*) from pet p) - (select count(*) from appln_clip ac,consign_animal c where ac.ac_id=c.ac_id))*100thx,vani |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-26 : 00:40:09
|
| Post table structure, some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|