Results 1 to 5 of 5

Thread: mySQL -

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    hmm BornToDrink's Avatar
    Join Date: Aug:2005
    Location: .
    Posts: 11,573

    mySQL -

    , , .

    .
    `table`, `id`, `expiration_date`, `check`
    expiration_date 0 timestamp.
    check 0 1, id .

    :
    :
    select * from `table` order by `check` DESC
    , check , `expiration_date` - . , check == 1 expiration_date < , check == 0...

    .

    , .
    Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
    .

  2. #2
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    ""

    Code:
    SELECT 
         `table`.*, 
         IF(`expiration_date`< CURRENT_TIMESTAMP() AND `check`=1, 0, 1+`check`) as `order` 
    FROM `table` ORDER BY `order` DESC
    , ! .

  3. #3
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , , .
    ?
    SELECT * FROM `table`
    WHERE `expiration_date`>{_}
    ORDER BY `check` DESC
    UNION
    SELECT * FROM `table`
    WHERE `expiration_date`<={_}

  4. #4
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    Quote Originally Posted by tedych View Post
    , , .
    ?
    SELECT * FROM `table`
    WHERE `expiration_date`>{_}
    ORDER BY `check` DESC
    UNION
    SELECT * FROM `table`
    WHERE `expiration_date`<={_}
    . ORDER BY UNION. .

  5. #5
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    Quote Originally Posted by _ShadoW_ View Post
    . ORDER BY UNION. .
    .
    , .
    UNION ALL , , .

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |