HOW TO: select only the last 2 records in a table.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gsb

    HOW TO: select only the last 2 records in a table.

    I'm not very good in mySQL but am trying to modify a script.
    It has to do with a log table.
    I want to retrieve the last 2 log records (if any) and if the last log
    entries are the same as my current (to be) entry, simply update the time in
    the last entry. But if not, simply insert the new entry.

    My question is how to select the last two entries from the log table?

    CREATE TABLE broadcast_log (
    id mediumint(8) unsigned NOT NULL auto_increment,
    time varchar(20) NOT NULL,
    entry varchar(255) NOT NULL,
    PRIMARY KEY (id)
    );

    Thanks.


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.497 / Virus Database: 296 - Release Date: 7/4/2003


Working...