Do it exist?

From: "Hal Davison" <hal(at)faams(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Do it exist?
Date: 2003-08-16 09:38:09
Message-ID: 3f3ca9e7_1@newsfeed
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

PostgreSQL Version 7.3.0

I hope I am not Cross Posting..with psql-novice..If so..sorry..

We have a situation where in our application the user provides the Order
Number for a delivery document.

When the Order Number is entered we need to determine if the Order Number
already exists and raise a flag if it does exist.

In another language I would do:
find first Order where Order.Order_num = "1111".
if avaialble Order then it_exists = true.

In PostgreSQL ?:
SELECT DISTINCT Order_num from Order_header where Order_num = '1111';

Is this close? If so, how to raise flage that row exists?

How we do somthing like this in SQL?

--
Hal Davison
Davison Consulting

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-08-16 12:36:11 Re: About primary keys -- made some progress
Previous Message Tim Andersen 2003-08-16 04:15:59 Re: About primary keys -- made some progress