select inner join problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

i have t tables reactie and form and this query

$sql = "select reactie.persid,form.oproep,form.foto, from
  INNER JOIN reactie ON (reactie.persid =  group by reactie.persid
order by reactie.persid DESC LIMIT 0,5";

  $result = mysql_query($sql);

Why i always get the error message invalid result resource? I want to group
the persid and order them DESC. But i cant get it to work can someone please


logid    persid
1            2
3            2
4            3


id        oproep        foto
2        bla                blabla
3        frt                 hadiha

Re: select inner join problem

On Sun, 1 May 2005 20:44:42 +0200, Irlan agous wrote:
Quoted text here. Click to load it

Remove first 'reactie', or replace 'inner join reactie on' by
'where'. See">

Firefox Web Browser - Rediscover the web - /
Thunderbird E-mail and Newsgroups - /

Re: select inner join problem

Quoted text here. Click to load it

In addition to the other advice about removing the first "reactie", which
was correct, you also have some confusion about the purpoose of GROUP BY.
GROUP BY is used when you want to use the so-called "aggregate" functions,
like SUM or COUNT.  If you aren't using SUM or COUNT (or another aggregate
function), then you don't need GROUP BY (and, in fact, CANNOT use GROUP

    SELECT reactie.persid,form.oproep,form.foto
    FROM reactie INNER JOIN form ON (reactie.persid =
    ORDER BY reactie.persid DESC
    LIMIT 0,5;

Note that, since reactie.persid ==, there is no point in including
both fields in the SELECT.
- Tim Roberts,
  Providenza & Boekelheide, Inc.

Site Timeline