Jump to content

if else in mysql query


bugcoder

Recommended Posts

hi everybody

 

i have this query

 

SELECT count(*) FROM `journal_entries` WHERE `created` BETWEEN '2011-07-01 00:00:00' AND '2011-08-03 00:00:00' AND `user_id` = 8;

 

one user can add more than one journal entry per day. I just want to consider one entry per day. if there is one entry, it should be counted in count(*) else not. can i do it just with mysql?

Link to comment
https://forums.phpfreaks.com/topic/243682-if-else-in-mysql-query/
Share on other sites

e.g if date range is for 7 days

 

and user added 15 journal entries but out of 7 days, one day he didn't add any entry. then result should be 6.

 

i.e we should not bother how many entries he did on one day. if he did even ten entries on one day it should be counted as 1 count.

 

I hope im able to clear my point... :-\

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.