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
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... :-\

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.