List:General Discussion« Previous MessageNext Message »
From:Davor Cengija Date:May 27 1999 12:56pm
Subject:RE: select all the rows inserted in the last session
View as plain text  
On Thu, 27 May 1999, Don Read wrote:

>> +----------------+---------------------+------+-----+---------+---------------
>> -+
>>| Field          | Type                | Null | Key | Default | Extra
>> +----------------+---------------------+------+-----+---------+---------------
>> -+
>>| id             | int(10) unsigned    |      | PRI | 0       | auto_increment
>>| |
>>| time_stamp     | timestamp(14)       | YES  |     | NULL    |
>>| topic          | varchar(60)         |      |     |         |

>> 
>>        how to select all the rows which are inserted in the last
>>        session in one query (if possible) without adding a new field
>>        which will have just a date_inserted info? obviously, i have
>>        to do some 'trick' with time_stamp.
>> 
>straight out of code:
>
>    $query=sprintf("select distinct ts from invtoday
>         order by ts desc limit 1");
>    $result = mysql_db_query("sales",$query);
>
>    if ($row = mysql_fetch_object($result)) {
>        $last=$row->ts;
>        mysql_free_result($result);
>
>         .... /* start a table */
>
>        $query= sprintf("select num,dept,acct,job,name,net,prof,mgn
>           from invtoday where ts='%s' order by %s",$last,$orderby);
>        $result = mysql_db_query("sales",$query);
>
>        while($row = mysql_fetch_object($result)) {

       yes, that's the solution. however, i just thought if could be
       done in just one query.

       thanks, Don...

       regards, Davor
-- 
      v
Davor Cengija
davor@stripped
==========================================
"No, thank you, please. I'm only lookin'."

Thread
select all the rows inserted in the last sessionDavor Cengija27 May
  • RE: select all the rows inserted in the last sessionDon Read27 May
    • RE: select all the rows inserted in the last sessionDavor Cengija27 May
RE: select all the rows inserted in the last sessionGert van 't Hof27 May
Re: select all the rows inserted in the last sessionDavor Cengija27 May