Hi
SELECT CASE
WHEN GroupID = 2 THEN
'' || GroupId || ''
END AS Grp
FROM Group
Thanks
Hi
SELECT CASE
WHEN GroupID = 2 THEN
'' || GroupId || ''
END AS Grp
FROM Group
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prasad RaveendranPosted Aug 27, 2023, 2:09 AM
Using
+operator (works for SQL Server, MySQL):If you provide information about the database you're working with, I can offer a more precise solution.
Abhishek YadavPosted Aug 24, 2023, 9:31 AM
It is just showing in output - 2
Ramco RamcoPosted Aug 15, 2023, 12:46 PM
Hi Jignesh
It is simply printing like this -
||2|| . Below is the code
Thanks
Jignesh KumarPosted Aug 15, 2023, 11:02 AM
Ramco RamcoPosted Aug 15, 2023, 8:57 AM
Hi Burney
It is printing this . It is normal text. Style not getting implemented
2
Thanks
Tasadduq BurneyPosted Aug 15, 2023, 7:39 AM
Try this
Ramco RamcoPosted Aug 15, 2023, 6:55 AM
Hi Mohammad
It is just showing in output - 2
Thanks
Ramco RamcoPosted Aug 15, 2023, 6:51 AM
Hi Jignesh
It is still giving same error . GroupId is int
Jignesh KumarPosted Aug 15, 2023, 6:26 AM
Hello Ramco,
You have missed else part in your query, please check below,
Ramco RamcoPosted Aug 15, 2023, 5:43 AM
Hi Bhargavi
It is still giving error - Incorrect syntax near |
Thanks
Cr BhargaviPosted Aug 15, 2023, 3:27 AM
Tahir AnsariPosted Aug 14, 2023, 6:52 PM
Hey Ramco Make sure that you have a column named "GroupID" in your "Group" table, and this query will generate a result column "Grp" with the HTML formatting for rows where GroupID equals 2.
If you are running this query in a database management tool or environment that displays query results as plain text, it won't interpret the HTML tags and instead, you'll see the raw HTML code as output.
Mohammad HussainPosted Aug 14, 2023, 5:57 PM
Hi Ramco,
SELECT
CASE WHEN GroupID = 2 THEN
'' + GroupID + ''
END AS Grp
FROM Group
*******OR*********
SELECT
CASE
WHEN GroupId = 2 THEN
CONCAT('', GroupId, '')
END AS Grp
FROM
Group;