select a.user_id, count(b.user_id) from login_info_1 a join login_info_2 b on a.user_id=b.user_id group by a.user_id
I have two table login_info_1,login_info_2 which has a column user_id in each table
select user_id,count(user_id) as cnt from login_info_1 group by user_id;
which gives me result like this
user_id cnt
101 4
102 5
103 1
107 7
same for the second table
select user_id,count(user_id) as cnt2 from login_info_2 group by user_id;
user_id cnt
101 3
102 2
103 2
107 1
I want to combine these two tables and the results should look like this
user_id cnt
101 7
102 7
103 3
107 2
Database: MYSQL
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke