At 19.02.2002  10:20, you wrote:
>What would you expect the database to return????
Thanks to all so far,
The query should give the smallest price MIN(preis) and the according "lfd" 
number of this record.
so the answer should only be one pair f.e.: 15200,00 | 41 . I think this 
should work, as this is the same
row ??? Maybe a bug? MySQL 3.22.32 is running.
Oliver

>You asked it to GROUP all the records with the same preis, that means it has
>to choose a value for each column of the record that is the result of each
>grouping, correct? So which of the (for example eleven (elf for you
>deutche;o)) different values of database.lfd did you want to have returned in
>your one resulting record? Obviously the database cannot stuff 11 values into
>one field....
>
>You need something like select min(preis), max(lfd) .... or some other
>summary function, OR you need to GROUP BY preis,lfd. You simply cannot have
>it both ways. In fact (Monty are you listening!!!) MySQL needs to throw an
>error on this sort of query because it is relationally incorrect and the
>database engine cannot fullfill it correctly.

I made some grouping errors, and wondered about the noise the linux-box made,
until i made a ps ax to see a lot of mysql-instances running mad ;-)


>For some odd reason though, human brains have a really hard time
>understanding this concept. If you want to really understand it, pretend to
>be a database and process a GROUP BY of the form he's having problems with,
>then you'll understand. ;o).
I do not understand why "select MIN(), something...." needs a GROUP BY in 
my case, as
the result is in the same row as mentioned above.


> > structual information of the database:
> > database.preis = decimal(12,2),
> > database.lfd=int(11),
> > database.typ=varchar(30),
> > database.marke=varchar(50)
> >
> > The following requests works
> > select min(preis) from database
> > also
> > select min(preis) from database where marke='marke' and typ not like 'R%'
> > and typ not like 'X%'
> >
> > but I have to get another value from the db so i choose
> >
> > select min(preis),lfd from database where marke='marke'
> > and typ not like 'R%'
> > and typ not like 'X%'
> > and typ not like 'C%'
> > group by preis
> >
> > this doesn´t bring the expected pair "preis / lfd"  but all available
> > "preis/lfd" grouped ascending.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to