Skip to content
Advertisement

SQL query to get rows contains value of another query

I have 2 tables transaction and query. Transaction table have unique tid and the query table has tid_(subtransactionid).

I want to get the list of all subtransactions by using tid.

I tried this

Advertisement

Answer

You can join the tables and use the operator LIKE in the ON clause:

If your database does not support the function concat() then you can use either:

or:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement