Click here to Skip to main content
15,890,438 members
Home / Discussions / Database
   

Database

 
GeneralRe: Http 500 error with register page Pin
and180y2-Jul-20 4:57
and180y2-Jul-20 4:57 
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

SQL
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

AnswerRe: Reporting data Pin
Mycroft Holmes19-Jun-20 12:25
professionalMycroft Holmes19-Jun-20 12:25 
GeneralRe: Reporting data Pin
Joan M20-Jun-20 1:11
professionalJoan M20-Jun-20 1:11 
GeneralRe: Reporting data Pin
David Mujica22-Jun-20 4:27
David Mujica22-Jun-20 4:27 
GeneralRe: Reporting data Pin
Joan M22-Jun-20 8:40
professionalJoan M22-Jun-20 8:40 
Questionhow to create relationship between tables based on field Pin
Cenator13-Jun-20 2:12
Cenator13-Jun-20 2:12 
AnswerRe: how to create relationship between tables based on field Pin
Richard Deeming15-Jun-20 0:59
mveRichard Deeming15-Jun-20 0:59 
Questiondriver oracle 9i por .net Pin
Member 148339584-Jun-20 3:11
Member 148339584-Jun-20 3:11 
AnswerRe: driver oracle 9i por .net Pin
Richard MacCutchan4-Jun-20 3:14
mveRichard MacCutchan4-Jun-20 3:14 
AnswerRe: driver oracle 9i por .net Pin
Jörgen Andersson4-Jun-20 4:29
professionalJörgen Andersson4-Jun-20 4:29 
GeneralRe: driver oracle 9i por .net Pin
Member 148339584-Jun-20 22:25
Member 148339584-Jun-20 22:25 
GeneralRe: driver oracle 9i por .net Pin
Jörgen Andersson5-Jun-20 1:08
professionalJörgen Andersson5-Jun-20 1:08 
GeneralRe: driver oracle 9i por .net Pin
Member 148339587-Jun-20 21:58
Member 148339587-Jun-20 21:58 
GeneralRe: driver oracle 9i por .net Pin
Jörgen Andersson7-Jun-20 23:20
professionalJörgen Andersson7-Jun-20 23:20 
GeneralRe: driver oracle 9i por .net Pin
Member 148339589-Jun-20 4:27
Member 148339589-Jun-20 4:27 
GeneralRe: driver oracle 9i por .net Pin
Jörgen Andersson9-Jun-20 4:45
professionalJörgen Andersson9-Jun-20 4:45 
GeneralRe: driver oracle 9i por .net Pin
Member 148339589-Jun-20 4:27
Member 148339589-Jun-20 4:27 
QuestionFailed to connect Mysql shared server database with Workbench 8.0.20 tool. Pin
Member 1167692314-May-20 22:49
Member 1167692314-May-20 22:49 
AnswerRe: Failed to connect Mysql shared server database with Workbench 8.0.20 tool. Pin
Bohdan Stupak29-Jun-20 4:26
professionalBohdan Stupak29-Jun-20 4:26 
Questionatabase constraints must follow relvar constraints Pin
Tara1112-May-20 14:15
Tara1112-May-20 14:15 
QuestionConvert raw byte[8192] of SQL Server XML datatype into a C# string? Pin
arnold_w1-May-20 2:32
arnold_w1-May-20 2:32 
AnswerRe: Convert raw byte[8192] of SQL Server XML datatype into a C# string? Pin
phil.o1-May-20 3:06
professionalphil.o1-May-20 3:06 
QuestionRead data from Azure database with C#-application, without installing a lot of applications? Pin
arnold_w25-Apr-20 7:24
arnold_w25-Apr-20 7:24 
AnswerRe: Read data from Azure database with C#-application, without installing a lot of applications? Pin
Richard MacCutchan25-Apr-20 7:42
mveRichard MacCutchan25-Apr-20 7:42 

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.