Answer the question
In order to leave comments, you need to log in
How to get data from multiple tables?
There are four different tables which are not connected with each other in any way (and it is not necessary).
How can one script of them get the data all in one heap? It's getting dark again and I can't figure it out :( It is
necessary to unload without repetitions) i.e. DISTINCT
Thank you.
Answer the question
In order to leave comments, you need to log in
I already answered here , but I will duplicate it again (and I remind you that there should be more details in the questions).
So:
select distinct your_value from (
select your_value from table_1
union
select your_value from table_2
union
select your_value from table_3
union
select your_value from table_4
) x;
select t1.name, t2.name
from table_1 t1, table_2 t2
where t1.id = t2.id;
UNION
connects different SELECT
in one request without repeating the connected data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question