Combination of Two fields in one SQL Query
hi there
I have a query regarding SQL database.
I need to combine two fields in a SQL query and is facing some trouble
My query is
SELECT MAN.intcaseID,
STA.strCaseStatName,
ACT.strCaseActTypeName,
MST.strActivityDetail,
MST.strModifiedBy,
UPr.strfname,
UPr.strlname,
MST.dtiModified
FROM tbl_casemain MAN LEFT JOIN tbl_caseseverity SEV ON SEV.intCaseSevID = MAN.intCaseSevID
INNER JOIN tbl_casemaindata MDA ON MDA.intCaseID = MAN.intCaseID
INNER JOIN tbl_casemainstatus MST ON MST.intCaseID = MAN.intCaseID
INNER JOIN tbl_casestatus STA ON STA.intCaseStatID = MST.intCaseStatID
INNER JOIN tbl_caseactivitytype ACT ON ACT.intCaseActTypeID = MST.intCaseActTypeID
INNER JOIN tbl_casemaindetails MDT ON MDT.intCaseID = MAN.intCaseID
LEFT JOIN tblUser_profile UPr
ON UPr.strcuid = MST.strModifiedBy
WHERE MAN.intcaseID = 19
ORDER BY MST.dtiModified
I have also tried using [UPr.strfname] & " " & [UPr.strlname] as FullName, but it is not working for me. Is there a concatenate entry in SQL that I should use? As when I enter #FullName# in my code on the web page it keeps on displaying something different instead of having two columns.
Please help me in this
Re: Combination of Two fields in one SQL Query
SQL uses + and not & to concatenate strings, and single quotes and not double quotes surrounding them.
[UPr.strfname] + ' ' + [UPr.strlname] AS FullName
Re: Combination of Two fields in one SQL Query
try this one:
SELECT CONCAT(ColumnA, ColumnB) AS ColumnZ
FROM Table
ORDER BY 1
Re: Combination of Two fields in one SQL Query
i guess this should work:
select product_id + product_name as product_fullstring
from tblproduct