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.
Author |
Topic |
Kevin007
Starting Member
3 Posts |
Posted - 2002-03-27 : 16:59:04
|
Hi All,I have one big table.Example:FDA_ID Class1_ID Class2_ID Class3_ID100 45 56 60200 45 76 90200 75 87 50200 34 23 10200 66 56 44300 56 22 77 300 34 67 21How do I write a query that would only show FDA_ID with Class1_ID= (75,45,34) and Class2_ID =(56)?Thanks,Kevin |
|
chuntley
Starting Member
8 Posts |
Posted - 2002-03-27 : 17:17:30
|
Something Like this?Select FDA_ID FROM [Table] Where class2_id = 56 and Class1_ID in (75,45,34)Or if that doesn't work for you try...Select FDA_ID FROM [Table] Where class2_id = 56 and (Class1_ID = 75 or Class1_ID = 45 or Class1_ID = 34) Edited by - chuntley on 03/27/2002 17:18:35 |
|
|
chadmat
The Chadinator
1974 Posts |
Posted - 2002-03-27 : 17:19:23
|
Without knowing much about your database, I would say this table looks like it is not normalized.However, the answer to your question:SELECT FDA_IDFROM OneBigTableWHERE Class1_ID in (75,45,34)ANDClass2_ID = 56-Chad |
|
|
|
|
|