mysql week range

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

mysql week range

Post by pleigh »

i was able to see a code somewhere and i was able to make a range of a week, for example, may 11 - may17, that is the range of the week(by the way, the sql query starts sunday as the first day of the week)...i was able to do it, however, all the records of that day reflects, for example, if i have 20 posts in 1 day, all the records are also posted and the range is reflected, what i wanted to do is that, if i have a record on a specific date even if it is 20 records, i dont want to retrieve all the records of those 20 and just get the date...i may sound confusing, here's my code by the way.

Code: Select all

SELECT distinct date_format(l.date, '%V') as weekno, date_format(l.date, '%X%V') as fixed_week_num, date_add(l.date, interval 0 DAY) as ws, date_add(l.date, interval 6 DAY) as we  FROM LoadLog l ORDER BY date_format(l.date, '%X %V')
thank you very much :)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

You already have a thread open on this issue :?

Topic Locked.
Locked