SQLTeam.com | Weblogs | Forums

Im doing something stupid!


#1

Hi,

I'm just trying to run a count a count and use the id09 to then match back and append address information but when I run this query get the following error

"SELECT Price,id09
FROM ALCbackup.dbo.LandReg
where Price >600000 and (select YoB,id09
from ALCbackup.dbo.brmain
where YoB <= '1966')

Msg 4145, Level 15, State 1, Line 15
An expression of non-boolean type specified in a context where a condition is expected, near ')'.

I'm sure its a school boy error but would appreciate your help.

thanks
Sean


#2

sorry managed to sort it out

SELECT ALCbackup.dbo.LandReg.Price, ALCbackup.dbo.LandReg.id09, ALCbackup.dbo.brmain.Yob, ALCbackup.dbo.brmain.id09
FROM ALCbackup.dbo.LandReg
INNER JOIN ALCbackup.dbo.brmain
ON ALCbackup.dbo.LandReg.id09 = ALCbackup.dbo.brmain.id09
WHERE ALCbackup.dbo.LandReg.Price >60000
AND ALCbackup.dbo.brmain.YoB <= ‘1966’