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 |
|
pipoD
Starting Member
3 Posts |
Posted - 2009-10-29 : 09:07:49
|
| Can anyone help me here? I am not very good with SQL query yet.table1ID Group Ref1 a 02 a 13 b 04 b 15 b 26 c 07 c 18 c 29 d 110 d 0as you can see from the table,1 and 2 belong to group a3,4 and 5 belong to group b6,7, and 8 belong to group c9 and 10 belong to group dHow can i write a query to filter out the group a and d only?Tons of thanks in advance =D |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-10-29 : 09:14:57
|
| select * from table_name where group in('a','d')Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
pipoD
Starting Member
3 Posts |
Posted - 2009-10-29 : 09:39:59
|
| ohhhh..okay~ i see~ Thanks a lot!!!but what if the group is not alphabet and its a whole list of numbers of few hundred records? cant possibly search all the numbers right?something likeID-Group-Ref1-123-02-123-13-221-04-221-15-221-26-311-07-311-18-311-29-445-010-445-1... |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-10-29 : 09:56:55
|
| You could do something like thiswhere group like '%-xxx-%' or group like '%-yyy-%',etc.JimEveryday I learn something that somebody else already knew |
 |
|
|
|
|
|