R
R
rakro2015-10-02 17:01:58
MySQL
rakro, 2015-10-02 17:01:58

Working with join in sql?

There are two tables t1 and t2.
If I try to make a query:
select t1.* from t1 join t2 on t1.t2_id = t2.id
then those records that have a connection will get into the selection.
With a left join, all records will be included (with and without an existing connection).
How can I find those records that have no connection?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kovalsky, 2015-10-02
@dmitryKovalskiy

It sounds like a very bad idea.. Can you specify the task?

I
Igor, 2015-10-02
@hurgadan

select t1.* from t1 left join t2 on t1.t2_id = t2.id where t2.id is null

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question