Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re:Query problem

Re:Query problem

From: Matt Lieber <lieber_at_ilog.com>
Date: 1998/11/06
Message-ID: <71vrk5$gct$1@news1-alterdial.uu.net>#1/1

Hello,

>You did not join nodes and nodecoordinates. There is no
>any join condition in your where clause. It is cartesian
>Andrew Protasov



>what does table nodecoordinates look like?
>Remember that fetching from two table will always return the cartesian
>product of their rows if you don't specify a join in the where-clause.
>try:
>select n.name,x,y,card from nodes n, nodecoordinates nc where >n.mapview=2
 and n.name=nc.name;
>Matthias

Thanks a lot guys! You are right, this is silly of me, I need to specify a join.
Matthias's query is correct - I was not even getting the right results. With the new query I still get duplicates as far as the names though, although the rows are unique (due to the different C1,C2 (card) values). I tried the query without "card" in it, but I still get duplicates. e.g.:

name                             x           y           card
-------------------------------- ----------- ----------- -------------------
-------------
Boston                           48          160         C1
Boston                           48          160         C2
Boston                           48          160         C3

Would there be a way to get only rows in respect to their different name values?
eg here:

 name                             x           y
 -------------------------------- ----------- -----------
 Berkshire                        48          160


Any ideas ??

Thank you !!!!

                                                            Matt


Matt Lieber wrote:

>
> Hi,
>
> I make a query on my database that returns the expected result, except
> that some value are duplicated (although the row is unique).
> e.g.:
> name x y card
> -------------------------------- ----------- ----------- -----------------
 --
> -------------
> Berkshire 48 160 C1
> Berkshire 48 160 C2
> Cape 48 160 C3
> Cape 48 160 C4
>
> How can I get only the 2 rows that differ by their names (that is,
 Berkshire
> and Cape)?? That is, some way to say: "no duplicates in name".
> e.g.:
> name x y
> -------------------------------- ----------- -----------
> Berkshire 48 160
> Cape 48 160
>
> my query looks like this:
> select nodes.name,x,y from nodes, nodecoordinates where mapview=2
>
> any ideas?
>
> Thanks!!
> Matt
Received on Fri Nov 06 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US