Wednesday, March 7, 2012

Question about a Select Statement

Hello,

I'm quite new to SQL and so my question may sound a bit strange.

Let me say I have the primary Keys 2049, 2090,4080,7803

For those 4 primary Keys I want to Select the rows from a table. How ca I do this in 1 SQL-Statement.

My way until now: Select [column-List] From tab1 Where ID=2049;
Select [column-list] From tab1 Where ID = 2090
...

So I split up into 4 Statements

There MUST be a way doing this in one statement!!!!!

Can you help me?

Kind regardsTry this:

where ID in (2049,2090,4080,7803)

No comments:

Post a Comment