pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hal Davison <hal@faams.net>
To: pgsql-sql@postgresql.org
Subject: Do it exist?
Date: Sat, 16 Aug 2003 05:38:09 -0400
Message-ID: <3f3ca9e7_1@newsfeed> (raw)

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





view thread (2+ messages)  latest in thread

Message-ID: <3f3ca9e7_1@newsfeed>
Permalink:  ../3f3ca9e7_1@newsfeed/
Also on:    postgresql.org/message-id/3f3ca9e7_1@newsfeed

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: hal@faams.net
  Subject: Re: Do it exist?
  In-Reply-To: <3f3ca9e7_1@newsfeed>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox