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
 New to SQL Server Programming
 Finding the right record

Author  Topic 

sambrown180
Starting Member

38 Posts

Posted - 2008-12-09 : 07:59:02
i am trying to write a query where i can search my product table for a large shirt that coss less than £49.99.

I wrote this query but for some reason it is running three and finding some of the wrong records. please can you tell me what is wrong with this query

select *

from Product

where Product_Name ='Shirt'

select *

from Product

where Product_Size ='L'

select *

from Product

where Product_Price <='£49.99'

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-12-09 : 08:07:17
I think you just mean this?

select *

from Product

where Product_Name ='Shirt' and Product_Size ='L' and
Product_Price <='49.99'

What is the data type of the price field?
Jim
Go to Top of Page

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-12-09 : 08:07:20
quote:
Originally posted by sambrown180

i am trying to write a query where i can search my product table for a large shirt that coss less than £49.99.

I wrote this query but for some reason it is running three and finding some of the wrong records. please can you tell me what is wrong with this query

select *

from Product

where Product_Name ='Shirt'

select *

from Product

where Product_Size ='L'

select *

from Product

where Product_Price <='£49.99'




Wat u really need by 3 queries.
Why cant u make it as one.
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2008-12-09 : 08:07:35
select *

from Product

where Product_Name ='Shirt'

and Product_Size ='L'

and

Product_Price <='£49.99'
Go to Top of Page

sambrown180
Starting Member

38 Posts

Posted - 2008-12-09 : 08:15:00
sorted thanks people
Go to Top of Page
   

- Advertisement -