MySQL, merging 2 or more tables before execute SELECT DISTINCT query?
Posted
by mysqllearner
on Stack Overflow
See other posts from Stack Overflow
or by mysqllearner
Published on 2010-03-23T09:20:31Z
Indexed on
2010/03/23
9:23 UTC
Read the original article
Hit count: 361
I want to calculate how many unique logins from 2 (or probably more tables).
I tried this:
SELECT count(distinct(l1.user_id))
FROM `log_1` l1
LEFT JOIN `log_2` l2
ON l1.userid = l2.userid;
But it gives me result of l1. If I didnt put l1 on li.userid (distinct), it said "ambiguous".
How do I combine the table, and then select unique login of the combined table?
© Stack Overflow or respective owner