MySQL Forums
Forum List  »  SQLite

Re: SELECT, COUNT and Inner Join
Posted by: Peter Brawley
Date: November 16, 2019 11:57AM

This forum is for importing/exporting btw SQLite and MySQL.

The usual sql method to combine names in one table with counts from another that has the same id key is ...

select a.name, b.N
from tbl_with_names as a
join (
  select id, count(*) N
  from tbl_data
  group by id
) b on a.id=b.id;



Edited 1 time(s). Last edit at 11/16/2019 04:37PM by Peter Brawley.

Options: ReplyQuote


Subject
Views
Written By
Posted
868
November 16, 2019 06:21AM
Re: SELECT, COUNT and Inner Join
815
November 16, 2019 11:57AM
219
November 16, 2019 04:30PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.