Click here to Skip to main content
14,574,365 members
   

Database

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder16-Jul-09 3:10
cofounderChris Maunder16-Jul-09 3:10 
PinnedHow to get an answer to your question PinPopular
Chris Maunder10-Nov-05 16:30
cofounderChris Maunder10-Nov-05 16:30 
QuestionSql server deadlock issue with table bulk insert and update on same table Pin
kali siddhu29-Jun-20 21:18
Memberkali siddhu29-Jun-20 21:18 
AnswerRe: Sql server deadlock issue with table bulk insert and update on same table Pin
Richard MacCutchan29-Jun-20 21:54
mveRichard MacCutchan29-Jun-20 21:54 
GeneralRe: Sql server deadlock issue with table bulk insert and update on same table Pin
kali siddhu30-Jun-20 23:29
Memberkali siddhu30-Jun-20 23:29 
GeneralRe: Sql server deadlock issue with table bulk insert and update on same table Pin
Richard MacCutchan30-Jun-20 23:31
mveRichard MacCutchan30-Jun-20 23:31 
GeneralRe: Sql server deadlock issue with table bulk insert and update on same table Pin
David Mujica1-Jul-20 5:36
MemberDavid Mujica1-Jul-20 5:36 
AnswerRe: Sql server deadlock issue with table bulk insert and update on same table Pin
ZurdoDev1-Jul-20 7:03
mveZurdoDev1-Jul-20 7:03 
QuestionHttp 500 error with register page Pin
and180y29-Jun-20 4:31
Memberand180y29-Jun-20 4:31 
AnswerRe: Http 500 error with register page Pin
ZurdoDev29-Jun-20 4:33
mveZurdoDev29-Jun-20 4:33 
GeneralRe: Http 500 error with register page Pin
and180y29-Jun-20 4:45
Memberand180y29-Jun-20 4:45 
GeneralRe: Http 500 error with register page Pin
ZurdoDev29-Jun-20 4:49
mveZurdoDev29-Jun-20 4:49 
AnswerRe: Http 500 error with register page Pin
Richard Deeming29-Jun-20 5:15
mveRichard Deeming29-Jun-20 5:15 
GeneralRe: Http 500 error with register page Pin
and180y29-Jun-20 5:21
Memberand180y29-Jun-20 5:21 
GeneralRe: Http 500 error with register page Pin
and180y29-Jun-20 7:40
Memberand180y29-Jun-20 7:40 
GeneralRe: Http 500 error with register page Pin
Richard MacCutchan29-Jun-20 9:36
mveRichard MacCutchan29-Jun-20 9:36 
GeneralRe: Http 500 error with register page Pin
and180y29-Jun-20 12:37
Memberand180y29-Jun-20 12:37 
GeneralRe: Http 500 error with register page Pin
Richard MacCutchan29-Jun-20 21:44
mveRichard MacCutchan29-Jun-20 21:44 
GeneralRe: Http 500 error with register page Pin
and180y1-Jul-20 8:03
Memberand180y1-Jul-20 8:03 
GeneralRe: Http 500 error with register page Pin
Richard MacCutchan1-Jul-20 9:10
mveRichard MacCutchan1-Jul-20 9:10 
GeneralRe: Http 500 error with register page Pin
and180y1-Jul-20 9:42
Memberand180y1-Jul-20 9:42 
GeneralRe: Http 500 error with register page Pin
and180y1-Jul-20 13:11
Memberand180y1-Jul-20 13:11 
GeneralRe: Http 500 error with register page Pin
Richard MacCutchan1-Jul-20 22:37
mveRichard MacCutchan1-Jul-20 22:37 
GeneralRe: Http 500 error with register page Pin
and180y19hrs 56mins ago
Memberand180y19hrs 56mins ago 
QuestionReporting data Pin
Joan M19-Jun-20 10:03
professionalJoan M19-Jun-20 10:03 
Hi all,

I've done a small database and PHP based web page to be able to track my working hours easily.

Last week a customer asked me how many time in total each month I had spend in one project and I had to get all the times, filter by month manually and sum it all to give him an answer... a matter of 10 minutes, but I want to automate this kind of things...

My question is:

I will have a table that will be able to be grouped by day, week, month, year or not grouped, but then, I have to get the sum of all hours that I worked in my office, the sum of the hours that I worked out of my office, the sum of the hours travelling...

I can only think of doing something like

SELECT  sumA,
        sumB,
        sumC
FROM
(
  SELECT sumA,
         type,
         "0" as sumB,
         "0" as sumC
  From table1

  WHERE type = A

UNION ALL

  SELECT sumB,
         type,
         "0" as sumA,
         "0" as sumC
  From table1

  WHERE type = B

UNION ALL

  SELECT sumC,
         type,
         "0" as sumA,
         "0" as sumB
  From table1

  WHERE type = C
)
AS VIEW1

Is this the way to do it?

I want to show the data in columns:

            Hours at the office   |   hours out of the office   |   hours travelling
_____________________________________________________________________________________________________
JANUARY    |                      |                             |
_____________________________________________________________________________________________________
FEBRUARY   |                      |                             |
_____________________________________________________________________________________________________
MARCH      |                      |                             |
_____________________________________________________________________________________________________
APRIL      |                      |                             |
_____________________________________________________________________________________________________
...


And I would like to solve this in the database part, not creating different tables and then working in the PHP area...

Sorry for this way too much generic question, I hope I made it clear enough for you to enlighten me.

Thank you in advance!
www.robotecnik.com[^] - robots, CNC and PLC programming

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.