Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2010
    Posts
    3

    Unanswered: Tricky select statement

    PHP Code:
    Hi

    I have the following data in one of the table 
    'TestTab'

    code,     finished_dtm,     end_dtm
    ===============================
    ABC    (null)        (null)
    ABC    2009-08-10    2009-08-10
    ABC    2009
    -08-01    2009-08-09
    XYZ    2008
    -02-04    2008-02-04    

    How to write a select satement to 
    return values when

    if finished_dtm is null then return that record
    else
      return 
    max(end_daterecord

    thank you 

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you've posted the exact same question in both this forum and the SQL Server forum

    you can't be using both database systems at the same time ...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2010
    Posts
    7
    Why are you trying to sell books here rather than helping the user? This is a forum, not a garage sale.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    haters gotta hate

    it's called a signature, dood

    you should get one too

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Jul 2010
    Posts
    7
    They probably have medication that would help you.

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by dan.mueller@trnsw View Post
    They probably have medication that would help you.
    you're just brimming with compassion

    like i said, haters gotta hate, and your jealousy doesn't look too good
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Jul 2010
    Posts
    7
    Dude, Get over yourself. Jealosy never entered the picture until your obviously overstated opinion of yourself prevailed. And the haters thing? What are you smoking? Where do you come up with this stuff?

    My original point (which is still my point) is that someone asked for help and you tried to sell him a book. That (IMHO) rates you right up there with the guys who actually post they will give you more info only if you pay them. Don't you think that type of attitude is missing the whole point of a forum? I certainly do.

    As for this ping pong match, you can have it. I am finished with you.

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by dan.mueller@trnsw View Post
    ... and you tried to sell him a book.
    that's ridiculous

    obviously you are new to forums and don't understand signatures

    Quote Originally Posted by dan.mueller@trnsw View Post
    I am finished with you.
    thank $deity for that
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  9. #9
    Join Date
    Jun 2009
    Location
    Lisboa, Portugal
    Posts
    78
    Hi,

    Wanna use 4gl for that or sql?
    If you use 4gl is more easy, with sql i think you should use a function with foreach command.
    You can use 4gl for that?
    LS

Posting Permissions

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