|
-
Aug 19th, 2002, 05:20 PM
#1
Thread Starter
Member
RESOLVED: concatenate sql String
I'm using the following SQL to populate a temporary table. Everything works fine but I would like to have a comma between EmployeeLast and EmployeeFirst. Everything I've tried splits the name into two fields instead of one.
Code:
sql = "SELECT tblReportData.EmployeeID AS Employee, Count(tblReportData.EmployeeID) AS Reports, [EmployeeLast]&[Employeefirst] AS Name INTO tbltmpReport "
sql = sql & "FROM tblEmployee INNER JOIN tblReportData ON tblEmployee.EmployeeID = tblReportData.EmployeeID "
sql = sql & "WHERE (((tblReportData.DateOpened) Between #" & StartDate & "# And #" & StopDate & "#) AND ((tblReportData.ParentID)=1)) "
sql = sql & "GROUP BY tblReportData.EmployeeID, [EmployeeLast]&[Employeefirst];"
Can anyone give me a clue?
I've have tried and a couple of other combos.
Code:
[EmployeeLast]" & " , " & " "[Employeefirst]
Last edited by Suidae; Aug 20th, 2002 at 03:07 PM.
I'm a misanthropic philanthropist!
Frog, the only white meat...
-
Aug 19th, 2002, 06:54 PM
#2
Try using + instead of &:
Code:
sql = "SELECT tblReportData.EmployeeID AS Employee, Count(tblReportData.EmployeeID) AS Reports, [EmployeeLast] + [Employeefirst] AS Name INTO tbltmpReport "
sql = sql & "FROM tblEmployee INNER JOIN tblReportData ON tblEmployee.EmployeeID = tblReportData.EmployeeID "
sql = sql & "WHERE (((tblReportData.DateOpened) Between #" & StartDate & "# And #" & StopDate & "#) AND ((tblReportData.ParentID)=1)) "
sql = sql & "GROUP BY tblReportData.EmployeeID, [EmployeeLast] + [Employeefirst];"
"It's cold gin time again ..."
Check out my website here.
-
Aug 20th, 2002, 03:01 PM
#3
Thread Starter
Member
Thanks for your reply... The result is still
DoeJohn and I'm trying to have a result of
Doe, John
I'm a misanthropic philanthropist!
Frog, the only white meat...
-
Aug 20th, 2002, 03:06 PM
#4
Thread Starter
Member
Got it! Just in case anyone wants to know.
[EmployeeLast] & ', ' & [Employeefirst]
I'm a misanthropic philanthropist!
Frog, the only white meat...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|