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
 sql query

Author  Topic 

hotshot_21
Yak Posting Veteran

97 Posts

Posted - 2006-03-07 : 23:44:08
i wan to select differnt rows from the same column.
for e.g
id A B C
1 43 66 89
2 65 22 65
3 11 99 09

now suppose i want to select all the columns of both id 1 & 2 by using single sql query what shud i do.

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2006-03-07 : 23:56:47
can u please elaborate more on what u are looking for.. From what I get is:

select id, A, B,C from Table_Name where id in (1,2)




Go to Top of Page

hotshot_21
Yak Posting Veteran

97 Posts

Posted - 2006-03-08 : 00:04:48
select id, A, B,C from Table_Name where id in (1,2)
this statement returns error.
saying invalid coumn name 1 and invalid column name 2

i want to select all the columns from rows whose 'id' i provide in single sql statement
Go to Top of Page

hotshot_21
Yak Posting Veteran

97 Posts

Posted - 2006-03-08 : 00:08:19
thanx i solved it myself.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-08 : 00:47:24
How did you solve it?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-03-08 : 03:02:58
definitely an F3..

--------------------
keeping it simple...
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-08 : 06:25:09
quote:

definitely an F3..




----------------------------------
'KH'


Go to Top of Page
   

- Advertisement -