SQLTeam.com | Weblogs | Forums

Ms sql query

Hi guys,

i ma trying to run below query but getting the reply null, can anyone help me out.
select SUM(dcost) from SOFTWARE where PNAME=
(Select pname from studies where institute='apple')

declare @SOFTWARE table(dcost money, PNAME varchar(150))
declare @studies table(pname varchar(50), institute varchar(50))

insert into @studies
select 'dede', 'apple' union
select 'jaja', 'apple' 

insert into @SOFTWARE
select 12.99, 'jaja' union
select 3000.99, 'kookoo'

select SUM(dcost) from @SOFTWARE where PNAME =
(Select pname from @studies where institute='sdsds')

most probably because there is no data for studies

What do you want it to return in that case?