sql - How To Join Different tables and sort according to most occuring record -


i have following tables:

enter image description here

i make query counts users registered since 1995 city_name , sort project registration. have tried far (pls note still bit new sql):

select count (userid), users.userid  users full join p.projectid project  registration_date >= '01/01/1995'  group (select * project project.projectid = user.projectid) 

however, not returning right result. help

do mean this:

select    project.projectid,   city.cityid,   count(userid) usercount project   inner join users on users.projectid = project.projectid   inner join city on city.cityid = users.cityid   users.registration_date > '1/1/1995' group project.projectid, city.cityid order    count(userid) desc 

you said 'sort project registration'; sorts project+city has registrations.

you can sub-select total registrations project, , include in order by, strikes me bit of odd output, made assumption :-)


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -