|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi, Can anyone help me to make a sql query (for a php website) in which to calculate with date and time??
There is: Userid, Begintime, Endingtime and Date. I have to get the hours a month (howmuch the person has worked that month). So userid x has worked y hours in january... rather nasty... Any help is welcome! |
|
#2
|
|||
|
|||
|
In general it should look like this (PSEUDO-SQL)
Code:
SELECT year(date), month(date), sum(endingtime-begintime) GROUP BY year(date), month(date) But it's specific to the DB and used datatypes. |
|
#3
|
|||
|
|||
|
Forgot the userid and the from clause, sorry.
Code:
SELECT userid, year(date), month(date), sum(endingtime-begintime) FROM mytable GROUP BY userid, year(date), month(date) |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > calculating with time & date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|