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

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -