| Author |
Topic |
|
shikhakaul
Starting Member
5 Posts |
Posted - 2009-04-01 : 19:34:58
|
i am very new to the topici have to check for 2 values ... can it be done using IN commandFor e,gproductno. priceabc 123xyz 123ysh 231abc 231if i want first line as output and also this table is results from another table so you cannot do like productno like abc etc.. how do get it ?????i hope i am able to explain  |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
shikhakaul
Starting Member
5 Posts |
Posted - 2009-04-01 : 20:05:09
|
| No i want smtg like where productno, price in (......)chking for both |
 |
|
|
singularity
Posting Yak Master
153 Posts |
Posted - 2009-04-01 : 22:32:08
|
| where productno in ('abc', 'xyz') and price in (123,231) |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2009-04-02 : 00:28:29
|
or if certain pairs need to go together:where (productno='abc' and price=123) or (productno='xyz' and price=321) elsasoft.org |
 |
|
|
shikhakaul
Starting Member
5 Posts |
Posted - 2009-04-02 : 15:59:37
|
| hiii thanks for ur replybut i cant use separate IN commands because it wont filetr that exact row..and i cannot use = , because this table is result from another table.... |
 |
|
|
shikhakaul
Starting Member
5 Posts |
Posted - 2009-04-02 : 16:00:37
|
| where productno in ('abc', 'xyz') and price in (123,231) will not give me one row that i want abc 123 |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2009-04-02 : 16:09:13
|
| use exists and you won't have any problems like this.___________________________________________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.5 out! |
 |
|
|
shikhakaul
Starting Member
5 Posts |
Posted - 2009-04-02 : 17:35:24
|
| i cannot use = wbecause there are hundreds of rows and what value wil come in rows i dont know |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-04-03 : 03:11:07
|
quote: Originally posted by shikhakaul i cannot use = wbecause there are hundreds of rows and what value wil come in rows i dont know
Did you try spirit1's suggestion?select columns from your_table as twhere exists (select * from other_table where productno=t.productno and price=t.price)MadhivananFailing to plan is Planning to fail |
 |
|
|
|