Re: select statement error?

From: shannon <shannon_at_nolunchmeat.com>
Date: Fri, 23 Jan 2004 23:28:19 +0100
Message-ID: <bus741$htm$03$1_at_news.t-online.com>


thanks bob,

WHERE customers . customerid = items_ordered . customerid

aah the theory is starting to click in

Bob Badour wrote:

> "shannon" <shannon_at_nolunchmeat.com> wrote in message
> news:bus4tm$m1l$04$1_at_news.t-online.com...
> 

>>Hi all,
>>
>>i am experimenting on the online tool, SQLcourse 2 tutorial, and have
>>entered the following query,
>>
>>SELECT lastname, item, quantity, price
>>FROM items_ordered, customers
>>GROUP BY lastname DESC;
>>
>>the answer I get looks like this,
>>
>>Smith Pogo stick 1 28.00
>>Schultz Pogo stick 1 28.00
>>Sanchez Pogo stick 1 28.00
>>Sakahara Pogo stick 1 28.00
>>Moore Pogo stick 1 28.00
>>Mendoza Pogo stick 1 28.00
>>Keller Pogo stick 1 28.00
>>Jones Pogo stick 1 28.00
>>Howell Pogo stick 1 28.00
>>Gray Pogo stick 1 28.00
>>Graham Pogo stick 1 28.00
>>Giles Pogo stick 1 28.00
>>Davids Pogo stick 1 28.00
>>Dalton Pogo stick 1 28.00
>>Cleaver Pogo stick 1 28.00
>>Brown Pogo stick 1 28.00
>>
>>DB shows only one pogo stick sold ( to dalton)
> 
> 
> You have a cartesian product between items_ordered and customers. You will
> need a where clause or join/on clause to specify how to match items_ordered
> with customers.
> 
> Also, you only group by one of the non-aggregate fields, which is an error
> even if your SQL parser fails to identify the error.
> 
> 
Received on Fri Jan 23 2004 - 23:28:19 CET

Original text of this message