-1

I have a field called "number" in my table modules. I want to show only specific entries, if the correct number is in my "number" field. Right now I am doing this with the following sql statement:

SELECT * 
from modules 
where number like CONCAT(
                    (SELECT id 
                    from account_metadata 
                    where hash='00cRTM')
                    ) 
ORDER BY date DESC

ID = 2385

This query is working fine as long as I have only one number insider the number field. As our system grows we need to save more than just one number insider our number field, therefore the entry could be something like this:

4235, 2385, 2058

More than one number, separated by commas.

Now my above sql query is not working anymore. Can someone help me and let me know how I should change my query to fetch all entries?

I would really appreciate any help.

Thanks in advance, Chris

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Christoph C.
  • 840
  • 2
  • 22
  • 38

1 Answers1

0

I found a solution by myself. It is working and all I need for testing purposes. Thanks to everyone who tried to help me.

SELECT * 
from modules 
where number like CONCAT('%',
                    (SELECT id 
                    from account_metadata 
                    where hash='00cRTM') ,'%'
                    ) 
ORDER BY date DESC
Christoph C.
  • 840
  • 2
  • 22
  • 38