Barrier Barrier - 10 months ago 28
SQL Question

How to put brackets around a SQL result, via SQL query?

I have a

query inside the jasper report and I want to put brackets around a specific generated result from it .

This is sql query,

SELECT `idMedication`,`idPatient`, `Drug` from medication

I want to put a brackets around
from the result, and I require to do it via the SQL code it self.

For an example, at the moment a drug is displayed like "Paracetamol" but I require it as "

Any idea on how to do this?


You can use the CONCAT function :

SELECT `idMedication`,`idPatient`, CONCAT('(', `Drug` ,')') AS Drug from medication