Barrier Barrier - 2 years ago 67
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?

Answer Source

You can use the CONCAT function :

SELECT `idMedication`,`idPatient`, CONCAT('(', `Drug` ,')') AS Drug from medication 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download