|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
mysql query to find weekends within two dates
hi,
i need help in writing a query to find the number of saturdays and sundays falling within a time period(two dates). thnks ramu |
|
#2
|
|||
|
|||
|
RE: mysql query to find weekends within two dates
What are your dates stored as? Timestamp? Date?
|
|
#3
|
||||
|
||||
|
RE: mysql query to find weekends within two dates
I'm not quite sure what you are asking. Are you try to find the number of Saturdays and Sundays between two dates, or trying to find the number of Saturdays and Sundays that are stored in some table in a database between two dates.
If it's the first one, do it in PHP, not MySQL. If it's the second one, try this: Code:
SELECT COUNT(*) FROM table_name WHERE date_column BETWEEN '2003-10-01' AND '2003-11-01' AND WEEKDAY(date_column) > 4 |
|
#4
|
|||
|
|||
|
RE: mysql query to find weekends within two dates
hi,
i am happy to see the reply to my posting here. 1. i am using Date filed to store dates. 2. i am trying find the number of Saturdays and Sundays between two dates stored in a table. thanks. ramu |
|
#5
|
|||||
|
|||||
|
RE: mysql query to find weekends within two dates
How about this? There may be a way of achieving the same result in a shoter way.
php Code:
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > mysql query to find weekends within two dates |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|