Right syntax of SQL query -
i have 2 tables in sql db:
subject(idsub,namesub); topic(idtop,nametop,idsub);
all want is:
+ select count(*) topic numtopic group idsub--> temp table + join 2 table temp , subject --> new table(idsub,namesub,numtopic)
but i've tried many time dont know syntax of sql query. help!
you can use left join
join subject
topic
.
select a.idsub, a.namesub, count(b.idsub) numtopic subject left join topic b on a.idsub = b.idsub group a.idsub, a.namesub
Comments
Post a Comment