Jump to content

[SOLVED] cannot show all rows


mga_ka_php

Recommended Posts

How do you correct this statement

 

SELECT a.siteID 'ID', a.siteDomain 'Site', COUNT(*) 'New Members'

FROM sites a LEFT JOIN users b ON a.siteID=b.siteID

WHERE

b.userDateRegistered>='1231513284' AND

b.userDateRegistered<='1231553482'

GROUP BY a.siteID

 

have 2 tables, sites and users, i want to view all the sites with how many members

 

the problem with this code it only display the sites with >0 users

 

i want to show even the 0 users

 

Site        | New Members

site.com  | 0

site2.com | 10

 

 

Link to comment
https://forums.phpfreaks.com/topic/140249-solved-cannot-show-all-rows/
Share on other sites

still doesn't work.

 

if i remove the WHERE

 

result would be

Site        | New Members

site.com  | 50

site2.com | 10

site3.com | 25

 

result is good, it gets the total number of new members, all time

 

but if i add the WHERE, it will not show all the sites, it will only show the sites with new members

 

Site        | New Members

site.com  | 50

site3.com | 25

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.