Re: Last ID Problem

Поиск
Список
Период
Сортировка
От
Тема Re: Last ID Problem
Дата
Msg-id 20050131193611.97235.qmail@web52409.mail.yahoo.com
обсуждение исходный текст
Ответ на Re: Last ID Problem  ("Vishal Kashyap @ [SaiHertz]" <vishalonlist@gmail.com>)
Ответы Re: Last ID Problem  ("Vishal Kashyap @ [SaiHertz]" <vishalonlist@gmail.com>)
Список pgsql-novice
Vishal,

will your suggestion protect my db if I have two
customers with the same name?  does it always return
the highest cust_id and is that *always* the last
cust_id entered?

tia...

--- "Vishal Kashyap @ [SaiHertz]"
<vishalonlist@gmail.com> wrote:

> Hi,
>
> > $id = "SELECT currval('cust_id')"; // used in an
> > attempt to get last id (colum 'cust id')entered
> into
> > db.
> >
> > $result = $db->Execute($sql);  // works fine.
> >
> > $id_result = $db->execute($id);  // $id_result has
> no
> > value.
>
> This is because currval fetched data during a
> transaction process and
> not after the process  is complete.
>
> the best way I suggest is
>
>  $id = "SELECT cust_id from customer  where
> customer_name ='$cust'
> order by cust_id desc limit1" ; // used in an
>
> --
> With Best Regards,
> Vishal Kashyap.
> Lead Software Developer,
> http://saihertz.com,
> http://vishalkashyap.tk
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Vishal Kashyap @ [SaiHertz]"
Дата:
Сообщение: Re: Last ID Problem
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: How to learn Postgres?