>Hi there. I have problems with mySQL

>What I would like to do is:

>I have a statement

>SELECT a.id AS ID, IDmark, IDrecipe, ocenjevalec, ocena,
>ROUND(AVG(ocena),1) as povprecje, COUNT(*) as all, IF (ID=ocenjevalec,
>'yes', 'no') as zeocenil
>FROM ocenerecepti, obiskovalci
>WHERE IDrecept = 1365 group by IDrecipe

>But 'zeocenil' allways returns no, because it groups all the data together
>and only the first data that has IDrecept = 1365 is checked with if sentance.

>I have to use group by because of AVG and count. Is there any if-like
>function that checks ALL records for the ID=ocenjevalec, not just the first
>(or the grouped by, seems to take 'ocenjevalec' as from the first data). If
>this is not possible, how can I achieve that? Should I make another
>recordset?

>Thank you for your time and patience

>Yours

>Jerry


---------------------------------------------------------------------
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