dcsimg
Results 1 to 4 of 4

Thread: Split data from one column into two

  1. #1
    Join Date
    Feb 2010
    Posts
    2

    Split data from one column into two

    Hello, is it possible to split data from one column into two, like shown in the link below?

    http://sites.google.com/site/janhouse00/sql

    Due to my stupidity, my last resort is to have two separate queries, one to fetch the date created, another for date closed, and dump them to some sort of array. However, I thought it can be done with one query, I have been stumbling over this issue for some time. Many thanks

  2. #2
    Join Date
    Apr 2009
    Posts
    86
    janhouse00, it looks like this should work for you:
    Code:
    SELECT QID
         , MIN(LAST_UPDATE) AS CREATED
         , MAX(LAST_UPDATE) AS CLOSED
    FROM MYTABLE
    GROUP BY QID

  3. #3
    Join Date
    Feb 2010
    Posts
    2
    Oh, silly me! Never thought of the min max in the date column. This solution would definitely help, thanks a bunch

    Cheers.

  4. #4
    Join Date
    Jul 2003
    Posts
    421
    I like this idea too!
    ________
    Thc
    Last edited by sql; 03-06-2011 at 02:16 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •