A
A
array052021-07-23 00:37:20
PHP
array05, 2021-07-23 00:37:20

Retrieve data from table A that does not match the data in table B?

Hello everyone, can you help?

I have two tables, table A and B.
Table A stores the names of songs in the shortcode field.
Table B contains the name of the song in the musicname field and the id of the song from table A in the id_task field, as well as the user id in the id_user field.

Question: How can I display data from table A that does not match the data in table B. That is:

A.id != B.id_task AND B.id_user != $id_user

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
array05, 2021-07-23
@array05

It's decided.

SELECT *

FROM A

WHERE NOT EXISTS (SELECT * FROM B WHERE A.id = B.id_task)

A
Anton Shamanov, 2021-07-23
@SilenceOfWinter

SELECT A.* FROM A JOIN B ON ... WHERE ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question