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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 query issue

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_ID
100 45 56 60
200 45 76 90
200 75 87 50
200 34 23 10
200 66 56 44
300 56 22 77
300 34 67 21

How 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
Go to Top of Page

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_ID
FROM OneBigTable
WHERE Class1_ID in (75,45,34)
AND
Class2_ID = 56


-Chad

Go to Top of Page
   

- Advertisement -