Re: Last ID Problem

From: "Vishal Kashyap (at) [SaiHertz]" <vishalonlist(at)gmail(dot)com>
To: "operationsengineer1(at)yahoo(dot)com" <operationsengineer1(at)yahoo(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Last ID Problem
Date: 2005-01-31 20:18:53
Message-ID: 77b69d210501311218fb713d8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-novice

Hi ,

> will your suggestion protect my db if I have two
> customers with the same name?

Yes , it would with the consideration that the sequence used to create
the cust_id is increasing by some number , customer may have same
name but in all means the customer name which is having the MAXIMUM
cust_id is ur need.

> does it always return
> the highest cust_id and is that *always* the last
> cust_id entered?
>

did i said I gave you a query that would run faster you may alternatively use

$id = "SELECT max(cust_id) from customer where customer_name ='$cust' " ;

Use explain in psql and u will know why I suggested the previous query.

--
With Best Regards,
Vishal Kashyap.
Lead Software Developer,
http://saihertz.com,
http://vishalkashyap.tk

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ned Lilly 2005-01-31 20:23:04 PostgreSQL at LinuxWorld Boston
Previous Message Marc G. Fournier 2005-01-31 20:14:45 New 7.2.7 Bundle Up

Browse pgsql-novice by date

  From Date Subject
Next Message operationsengineer1 2005-01-31 21:01:52 Re: Last ID Problem
Previous Message Mitch Pirtle 2005-01-31 19:52:08 Re: Last ID Problem