N
N
Name2017-09-13 19:28:51
SQL
Name, 2017-09-13 19:28:51

Remove from the database by comparing with the values ​​that are written in one field separated by commas?

There is a table
id - photo - his
in the his field, the data is written like this: 343-2, 123-1, 453-2, 355-1, 324-1,
234-2 -2, 123-1, 453-2) take 343,123,453 (this is the id) and display their photo

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Holub, 2017-09-13
@User782

Try like this:

SELECT a.photo
FROM table AS a
WHERE EXISTS (SELECT 1 FROM table AS b WHERE ','||b.his||',' LIKE '%,'||a.id||'-_,%' AND b.id = <определенное id>);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question