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.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 forimh a sql query

Author  Topic 

svibuk
Yak Posting Veteran

62 Posts

Posted - 2011-06-17 : 08:27:12
1)
select i.acno,i.pa_no,datepart(year,i.sdate) as YR
, heads, i.address_1
,i.address_2,i.address_3,i.city, ISNULL(NULLIF(i.pin,''),0) as IPIN , i.email, i.tel_off,
t.contact1 , t.designation, t.address_1, t.address_2 , t.address_3,t.city,ISNULL(NULLIF(t.pin,''),0) as TPIN
,ISNULL(NULLIF(t.email1,''),'-') as email1
from table1 i,table2 t , table3 z

2)
select sum(basic+surcharge+eduess) from table3 z

3)
select count(distinct vno) as count from table3 z

i have the above query 1

in that i need qry 2 & 3 ,

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-07-08 : 05:07:02
You can use that as a subquery in query1

select ...., (select sum(basic+surcharge+eduess) from table3 ) as sum, (select count(distinct vno) as count from table3) as count from ....

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -