I call a webservice and i get a list of codes: A, B, C, D, E, F etc.
In my problem i get A, B, C.
There's a table where you can create sets with the above codes and for each set you can add a specific message so the end user can understand the codes. For example A means "ok", B means "you can log in" So for the set A, B a message could be "you can log in". The code sets are saved in one column (codes).
In my problem i query the table by using the following query:
Select setid, codes, messagedescr from table1 where setid = (select max(setid) from table1
And codes Like '%A%'
And codes Like '%B%'
And codes Like '%C%');
This query finds a row but it's wrong, the column "codes" contains the following codes: A, B, C, D.
For example:
setid codes messagedescr
1 A, B, C, D You can login
2 B, C, D You can login for one day
3 A, C, E You can login but update your profile
4 B, C, E, F You cannot login
I don't know the order of the codes from the webservice and i don't how the codes are saved in the table, so i had to make something without order, this why i used the Likes. There are 25 codes: A, B, C, etc
How can i fix the query so i can find the correct message?
Thanks!
Update: Thank you all for your answers and specially the more detailed answers that had extra work such as creating the tables. The table might have from 10-20 rows. One case is to create another table for the codes and join it with the set ids. Or the other case is to count the lengths of the codes from the service and see if they match with the length in the table.