Re: SQL question

From: Krish Mohan <kmohan_at_cisco.com>
Date: Mon, 24 May 1999 12:09:42 -0700
Message-ID: <3749A3F6.988D2EAC_at_cisco.com>


Kenny Gumps's select will not return one row. Since A, B, C & D form the PK. But this statement will. But it may not be what you really want!!

Select *
From test t

where t.a = 'A'
and t.b = 'B'
and t.c = '1'

and rownum < 2;

regards
krish mohan

Kenny Gump wrote:

> select distinct A, B, C
> from test.t
> where t.a = 'A'
> and t.b = 'B'
> and t.c = '1';
>
> This will return only one row.
>
> Kenny Gump
> OCP 7.3 DBA
>
> Ken Halsted wrote in message <927239162.115.33_at_news.remarQ.com>...
> >I am wondering if there is a way to ensure that only 1 row of information
> >get's returned in a Query?
> >
> >For example if a table (test) exists like:
> >
> >A VARCHAR2(1)
> >B VARCHAR2(1)
> >C VARCHAR2(1)
> >D VARCHAR2(1)
> >E VARCHAR2(1)
> >
> >A, B, C, D make up the key.
> >
> >Select *
> >From test t
> >where t.a = 'A'
> >and t.b = 'B'
> >and t.c = '1'
> >
> >I only want one row to be returned even if there are more than one type of
> D
> >information. I only want to see the unique rows of C for every A and B.
> >
> >How can I do this easily?
> >
> >Thanks for any help at all.
> >
> >Ken Halsted.
> >
> >--
> >_________________
> >Kenneth W. Halsted
> >Mountaire Corporation
> >ph: (501) 399-8812
> >url: http://www.mountaire.com
> >email: kenman_at_mail.snider.net
> >
> >
> >

--
Krish Mohan        Cisco Systems, Inc    408-526-8474
   The Pilot with an unusual attitude !

                       <_)
    o            ______/|__   |
   __\___....---~      /|  ~~\|
  |               ____/_|_   _|>
  |~~/~~~---...__/   /  |/~~~ |
  |_/         --===OOOOOO=    |
Received on Mon May 24 1999 - 21:09:42 CEST

Original text of this message