RE: [PHP] Grr SQL syntax error silghtly OT
| From: | joakim dot andersson at cybercom dot se | Date: | Tue, 09 Jul 2002 08:26:34 +0000 |
| Subject: | RE: [PHP] Grr SQL syntax error silghtly OT | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-106267@lists.php.net to get a copy of this message | ||
I assume that 2count should really be count and 2 is just the line-number
you added in this post...
tececo_stats.views is (probably) the name of a column and cannot be used as
an alias. Change it to something else.
change count(*) to count(tececo_stats.*) (I think that's what you want)
And you probably need a group by-statement at the end: GROUP BY
whatever_you_need_to_group_by
It's really difficult to answer your questions without the table designs,
the error message and what you expect this query to do. And, it's not
slightly OT. It's totally OT. :-)
Regards
Joakim Andersson
> -----Original Message-----
> From: JJ Harrison [mailto:webmaster@tececo.com]
> Sent: Tuesday, July 09, 2002 10:10 AM
> To: php-general@lists.php.net
> Subject: [PHP] Grr SQL syntax error silghtly OT
>
>
> Sorry :}
>
> I get a SQL syntax error at line two of the query:
>
> $query = "select
> 2count(*) as tececo_stats.views, meta_data.title
> from
> meta_data, tececo_stats
> where
> meta_data.id = tececo_stats.id";
>
> I have stared at this 'till i felt dizzy. can someone tell me
> what I am
> doing wrong so that I can learn from it?
>
> Thanks in advance
>
>
> --
> JJ Harrison
> webmaster@tececo.com
> www.tececo.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>