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 |
|
kalaivani
Starting Member
11 Posts |
Posted - 2007-12-18 : 02:00:06
|
| Retrieve details of all the titles whose name contains the word computer and the word cooking (words can be present in any order. Example, Computer xyz cooking or Cooking pqrs computer) |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2007-12-18 : 02:04:57
|
| [code]Select * From YourTable Where (ColumnName Like '%Computer%' Or ColumnName Like '%Cooking%')[/code]Chiraghttp://www.chirikworld.com |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2007-12-18 : 02:38:38
|
quote: Originally posted by chiragkhabaria
Select * From YourTable Where (ColumnName Like '%Computer%' Or ColumnName Like '%Cooking%') Chiraghttp://www.chirikworld.com
I think it should have been and ChiragSelect * From YourTable Where (ColumnName Like '%Computer%' Or ColumnName Like '%Cooking%') this retrieves results with either of two presentWhileSelect * From YourTable Where (ColumnName Like '%Computer%' AND ColumnName Like '%Cooking%')ensures we have both Computer and Cooking in text which is what is required i think |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-18 : 03:02:50
|
quote: Originally posted by kalaivani Retrieve details of all the titles whose name contains the word computer and the word cooking (words can be present in any order. Example, Computer xyz cooking or Cooking pqrs computer)
If you are new to SQL. learn ithttp://www.sql-tutorial.net/http://www.firstsql.com/tutor.htmhttp://www.w3schools.com/sql/default.aspMadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-18 : 03:31:47
|
Or try the FULLTEXT serarch engine? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|