Re: Query Output Issue
- Date: Fri, 23 May 2008 13:35:53 -0700
- From: "Rob Wultsch" <wultsch@xxxxxxxxx>
- Subject: Re: Query Output Issue
On Fri, May 23, 2008 at 3:06 PM, <mdimartino@xxxxxxxxxxxxxxxxx> wrote:
>
> ----- Original Message -----
> From: "Rob Wultsch" <wultsch@xxxxxxxxx>
> To: mdimartino@xxxxxxxxxxxxxxxxx
> Cc: "MYSQL General List" <mysql@xxxxxxxxxxxxxxx>
> Sent: Friday, May 23, 2008 11:10:56 AM GMT -08:00 US/Canada Pacific
> Subject: Re: Query Output Issue
>
> On Fri, May 23, 2008 at 1:47 PM, <mdimartino@xxxxxxxxxxxxxxxxx> wrote:
>> Still getting and error on the last line
>>
>> SELECT
>> p1.POPS AS `POPA`,
>> p2.POPS AS `POPZ`
>> FROM
>> circuits
>> INNER JOIN pops.POPS as p1 WHERE circuits.popID_A =p1.popID
>> INNER JOIN pops.POPS as p2 WHERE circuits.pop_ID_Z =p2.popID
>
> I guess I am mindreader cause you did not post your error message. I
> really should hire myself at higher fees with this new found ability.
>
> Please stop:
> Top posting. Most lists either top post or bottom post, and some mix.
> This list mixes a small amount, but generally bottom post. When in
> doubt I follow the convention of the first response.
> Posting the relationship. Posting your table create syntax on the
> other hand would be useful.
>
> --
> Rob Wultsch
> wultsch@xxxxxxxxx
>
> ----- Original Message -----
>
> SQL query: Documentation
>
> SELECT l1.POPS AS `POPA` , l2.POPS AS `POPZ`
> FROM circuits
> INNER JOIN pops.POPS AS p1
> WHERE circuits.popID_A = l1.popID
> INNER JOIN pops.POPS AS p2
> WHERE circuits.pop_ID_Z = l2.popID
> LIMIT 0 , 30
>
> MySQL said: Documentation
> #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN pops.POPS as p2 WHERE circuits.pop_ID_Z =l2.popID
> LIMIT 0, 30' at line 7
Your using WHERE instead of ON. Not sure why I did not see that earlier...
SELECT l1.POPS AS `POPA` , l2.POPS AS `POPZ`
FROM circuits
INNER JOIN pops.POPS AS p1
ON circuits.popID_A = l1.popID
INNER JOIN pops.POPS AS p2
ON circuits.pop_ID_Z = l2.popID
LIMIT 0 , 30
http://dev.mysql.com/doc/refman/5.0/en/join.html
--
Rob Wultsch
wultsch@xxxxxxxxx
wultsch (aim)
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=royale@xxxxxxxxxx