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 |
|
ackweb
Yak Posting Veteran
54 Posts |
Posted - 2003-03-28 : 18:45:43
|
| I'm trying to support a full name search, but have separate "Fname" and "Lname" fields. If I use the following SQL query (where "strSearch" is an input parameter from a web form), I get an error indicating that "Name" isn't a valid column:"SELECT Fname + ' ' + Lname AS Name from tblPeople WHERE Name LIKE '%" + strSearch + "%'"The query works when I use either the "Fname" or "Lname" fields in the WHERE clause. However, this doesn't provide the full name search capability that I'm trying to create. Is there another way to do this? I'd appreciate any guidance on this. Thanks! |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-03-28 : 19:16:18
|
| YOu need to repeat the expression in the where clause, or use a subquery.Select A+B as CFROM twhere A+B > 0orSELECT CFROM(select A+B as C From t) subqwhere c > 0- Jeff |
 |
|
|
|
|
|