Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
select * from AdvertisementInformation where SubCategory ='Home Tutor' and AdType ='Wanted' and 'Offer'

i want retreive both column value where adtype = wanted and adtype = offer but this query give error
Posted
Comments
[no name] 7-Nov-12 5:56am    
what's the error...?
M@anish 7-Nov-12 5:58am    
Msg 4145, Level 15, State 1, Line 1
An expression of non-boolean type specified in a context where a condition is expected, near 'Offer'.

SQL
select * from AdvertisementInformation where (SubCategory ='Home Tutor' and AdType in ('Wanted','Offer'))



Try this , You can't use boolean operators to select values using where clause

this must give you the solution
 
Share this answer
 
v3
Comments
M@anish 7-Nov-12 6:21am    
but it gives only one record for offer and one record for wanted and i want the complete records for both value
SQL
select * from AdvertisementInformation where SubCategory ='Home Tutor' AND ( AdType ='Wanted' OR AdType ='Offer')
 
Share this answer
 
Comments
M@anish 7-Nov-12 6:22am    
but it gives only one record for offer and one record for wanted and i want the complete records for both value
M@anish 7-Nov-12 6:25am    
please..................
damodara naidu betha 7-Nov-12 6:55am    
post your table data ...
select * from AdvertisementInformation where SubCategory ='Home Tutor' and AdType ='Wanted' or AdType = 'Offer'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900