Output query in MySQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mike1961
    New Member
    • Apr 2008
    • 66

    Output query in MySQL

    Hello everyone.

    I have this query and this output:

    Code:
    SELECT * , 
    COUNT(STATE) AS strSTATE, 
    COUNT(TYPESTATE) AS strTYPESTATE 
    FROM 
    tbl_MYSQL 
    WHERE STATE = 'ABSENT' 
    AND DATE = '2008-04-29' 
    GROUP BY STATE, 
    TYPESTATE, 
    DESCR 
    ORDER BY DESCR ASC
    [HTML]
    AAA BBB-ZONE CA 9168381000 Expectancy 1 29/04/2008
    AAA BBB-ZO CA-UOD MONTAG-1 9168381620 Disease 1 29/04/2008
    AAA BBB-ZO CA-UOD MONTAG-9 9168381629 Holiday 1 29/04/2008
    AAA BBB-ZO CA-UOD DIENSTAG 9168381650 Permit 1 29/04/2008
    AAA BBB-ZO CA-UOD DIENSTAG 9168381650 Holiday 1 29/04/2008[/HTML]

    To have this output?
    Can you help me?

    [HTML]
    AAA BBB-ZONE CA 9168381000 Expectancy 1 29/04/2008
    Disease 1 29/04/2008
    Holiday 1 29/04/2008
    Permit 1 29/04/2008
    Holiday 1 29/04/2008[/HTML]
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    You can not get such output using only MySQL. You can get such format with the combination of MySQL and PHP/ASP.

    Comment

    • Mike1961
      New Member
      • Apr 2008
      • 66

      #3
      Originally posted by mwasif
      You can not get such output using only MySQL. You can get such format with the combination of MySQL and PHP/ASP.
      Thanks x your reply, but one example ?

      Comment

      • arggg
        New Member
        • Mar 2008
        • 91

        #4
        what programming language are you using or are you just querying the database through the CMD prompt or GUI?

        Comment

        • Mike1961
          New Member
          • Apr 2008
          • 66

          #5
          Originally posted by arggg
          what programming language are you using or are you just querying the database through the CMD prompt or GUI?
          thanks, I use language ASP.

          Comment

          • arggg
            New Member
            • Mar 2008
            • 91

            #6
            Originally posted by Mike1961
            thanks, I use language ASP.
            I'm not familiar with ASP but basically what you would do is send the query then fetch the results. Then use a while loop to go through each row returned and get the data you want from it.

            Comment

            • Mike1961
              New Member
              • Apr 2008
              • 66

              #7
              Originally posted by arggg
              I'm not familiar with ASP but basically what you would do is send the query then fetch the results. Then use a while loop to go through each row returned and get the data you want from it.
              Ok, I understand...

              Can I have the same query this output ( I add Total Rows and Total Columns... ) : ?

              Code:
              ID_DESCRIPTION     Expectancy    Disease    Holiday   Permit  DATE       TOTAL
              10                 1             1          2         1       29/04/2008     5
              11                 2             0          2         3       29/04/2008     7
              Total              3             1          4         4       29/04/2008     12

              Comment

              Working...