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 |
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2011-06-21 : 06:16:25
|
| Hi,I have a SELECT query as follows. What I would like to do is, to search (filter) the whole select columns (col1,col2,col3,col4) with a single search criteria.Select col1,col2,col3,col4 FROM table1sample:col1/col2/col3/col4Peter/2/100/19-06-2011John/3/200/20-06-2011I would like to filter for 2 but I dont want to use something like that,Select col1,col2,col3,col4 from table1 where col2 = 2Best Regards |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-06-21 : 06:53:59
|
| Not quite clear what you are asking - but is it:a) you want all the rows where col2 is 2 regardless of what other columns have? Your query already does that.b) you want to specify filter criteria for other columns also? If so you would use AND or OR to add additional filtering criteria.c) you want to have dynamic search conditions? If so, this page might help: http://www.sommarskog.se/dyn-search-2008.html |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-06-21 : 06:54:21
|
Not sure what you mean:where col1=this OR col2=that OR ... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|
|