Re: INNER JOIN
| From: | Jeremy | Date: | Thu, 23 Nov 2000 01:21:50 +0000 |
| Subject: | Re: INNER JOIN | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26742@lists.php.net to get a copy of this message | ||
The query does not fail, but instead returns a blank screen.
I cannot change all other ratings to comments.rating... as rating = the avg
of those comments.rating for a specific tabid
A tab would be synonymous with an Article
----- Original Message -----
From: "Ignacio Vazquez-Abrams" <ignacio@openservices.net>
To: "Jeremy" <sparhawk@cleanweb.net>
Cc: <php-general@lists.php.net>
Sent: Wednesday, November 22, 2000 2:14 PM
Subject: Re: [PHP] INNER JOIN
> On Wed, 22 Nov 2000, Jeremy wrote:
>
> > Is this proper syntax for MySQL?
> >
> > For some reason, it is not returning results
> >
> > if (!($result = mysql_query("SELECT comments.tabid, avg(comments.rating)
as rating, tabs.band,
> > tabs.song FROM comments, tabs WHERE comments.tabid = tabs.id AND rating
<> 'none' AND tabs.instrument = '$instrument'
> > GROUP BY comments.tabid
> > ORDER BY rating DESC
> > "))) {
> > echo("Fail");
> > }
> >
>
> Some quick questions:
> 1) Does the query work when entered interactively?
> 2) Does it work if you precede 'rating' by 'comments.' in all places
(except
> after 'as', of course)?
>
> --
> Ignacio Vazquez-Abrams <ignacio@openservices.net>
>
>