Обсуждение: Problem with the postgresql operator.

Поиск
Список
Период
Сортировка

Problem with the postgresql operator.

От
"KH Lim"
Дата:
Dear All,
 
    What is the correct operator for not equal to in select statement? I'm a bit confuse.
 
Situation
 
Let say I want to select stock_key from stock_lot with the condition stock_lot's lot_no is not equal to stocks' lot_no. What select statement should I use?
 
Thank you in advance
 
Lim

Re: Problem with the postgresql operator.

От
Oliver Elphick
Дата:
On Tue, 2002-01-15 at 06:39, KH Lim wrote:
> Dear All,
>
>     What is the correct operator for not equal to in select statement? I'm a bit confuse.
>
> Situation
>
> Let say I want to select stock_key from stock_lot with the condition stock_lot's lot_no is not equal to stocks'
lot_no.What select statement should I use? 

The operator is !=

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
    "For I know that my redeemer liveth, and that he shall      stand at the latter day upon the earth"
                                 Job 19:25  

Re: Problem with the postgresql operator.

От
"Josh Berkus"
Дата:
KH Lim,

In the future, this sort of question is more appropriate for the PGSQL-NOVICElist.  

>     What is the correct operator for not equal to in select statement? I'm a
>  bit confuse.
> 
> Situation
> 
> Let say I want to select stock_key from stock_lot with the condition
>  stock_lot's lot_no is not equal to stocks' lot_no. What select statement
>  should I use?

SQL92 Standard Syntax (works on PostgreSQL):
WHERE stock_lot.lot_no <> stocks.lot_no

Not SQL92 Standard, but also works on PostgreSQL:
WHERE stock_lot.lot_no != stocks.lot_no

You should also pick up an introduction to PostgreSQL and to SQL in general. See
http://techdocs.postgresql.org/bookreviews.phpfor several booksuggestions.  In English, "Database Queries for Mere
Mortals"is a good onefor novices.
 

If you need a book in another language, e-mail me back and I'll try to locate abook that has been translated into your
preferredtongue.
 

-Josh Berkus


______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


Re: Problem with the postgresql operator.

От
GB Clark
Дата:
On Tue, 15 Jan 2002 14:39:54 +0800
"KH Lim" <limspirit@hotmail.com> wrote:

> Dear All,
> 
>     What is the correct operator for not equal to in select statement? I'm a bit confuse.
> 
> Situation
> 
> Let say I want to select stock_key from stock_lot with the condition stock_lot's lot_no is not equal to stocks'
lot_no.What select statement should I use?
 
> 
> Thank you in advance
> 
> Lim
> 
Just use the standard SQL... <>

Works just fine and it is in the books.

GB


-- 
GB Clark II             | Roaming FreeBSD Admin
gclarkii@VSServices.COM | General Geek           CTHULU for President - Why choose the lesser of two evils?