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 |
Zath
Constraint Violating Yak Guru
298 Posts |
Posted - 2007-03-07 : 09:26:46
|
I have a select and want to bring back one field as the combination of 2 fields....Something like:SELECT a.reportedBy AS 'user',b.fName,b.lNameFROM tblReports a,tblUsers bWHERE a.reportedBy = b.userIdNow, in the code behind, I can add fname and lname but it would be more efficient to do it in the sql.Something likea.reportedBy AS 'user' (user = b.fname + ' ' + b.lname)Can't find the syntax for this one.Thanks,Zath |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-07 : 09:32:47
|
[code]SELECT a.reportedBy AS [user], b.fName + b.lName AS [fullname]FROM tblReports a INNER JOIN tblUsers bON a.reportedBy = b.userId[/code] KH |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-07 : 09:37:09
|
quote: Originally posted by khtan
SELECT a.reportedBy AS [user], b.fName + ' ' + b.lName AS [fullname]FROM tblReports a INNER JOIN tblUsers bON a.reportedBy = b.userId KH
Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
Zath
Constraint Violating Yak Guru
298 Posts |
Posted - 2007-03-07 : 09:48:07
|
Thanks!Exactly what I was trying to do.Zath |
|
|
|
|
|