Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

SQL Problem

Options
  • 25-03-2005 2:21pm
    #1
    Registered Users Posts: 252 ✭✭


    Hi
    ive got an sql issue thats been wrecking my head

    this is the sql:

    SELECT DISTINCT thread FROM messages ORDER BY time DESC LIMIT 7

    basically that selects the 7 most recent entries in messages ...which is grand
    HOWEVER the actual resultset is not sorted by time

    Can anyone tell me how to do so?

    tnx


Comments

  • Registered Users Posts: 640 ✭✭✭Kernel32


    Is the time column an actual datatype for datetime? or possible a varchar? I have seen it done before where string datatypes are used to store dates and time. If thats the case you will need to use some sort of conversion in the sql, it will depend on the database. SQL Server would use CONVERT or CAST for instance.


  • Registered Users Posts: 252 ✭✭ConsultClifford


    time is in fact and int.....


  • Registered Users Posts: 1,184 ✭✭✭causal


    I think you need to include 'time' (assuming that is the correct column name) in the SELECTed list of columns.


    causal


Advertisement