Reputation: 552
We have 2 tables "JUNE" and "SEPTEMBER". there are 34 columns, like - id, date1, date2..... and up to date30 . same as for "SEPTEMBER" table. We have same id's in both the tables. but the values in the columns are different. We just want to join 3-4 columns in both the tables, and match the values, in not below one, the value should be greater than 1.
Upvotes: 1
Views: 150
Reputation: 3136
select j.DATE1, s.DATE1
from JUNE j
left join SEPTEMBER s
on j.id=s.id
where value>1
Is that you looking for or please give us more information.
Upvotes: 1
Reputation: 10263
This should work:
SELECT id, date1, date2, FROM JUNE WHERE value>1
UNION
SELECT id, date1, date2, FROM SEPTEMBER WHERE value>1
See also MySQL docs on UNION syntax.
Upvotes: 0