0

I keep getting the following error whenever I try to run this query on my "spot" table:

#1054 - Unknown column 'a.Longitude' in 'field list'

The weird thing is though that the column DOES in fact exist, is spelled the same way, and has thousands of rows of data. Even weirder, a similar query runs on my "retail" table and has no problem getting the longitude, the only difference is 3 column names change (longitude and latitude stay the same). I also checked the datatypes for both tables and once again, exactly the same. If it matters, my mySQL version is 5.0.92-community. Anybody know what's going on here???? :@

Query

SELECT a.SpotID, a.CreatedBy, a.CreatedOn, a.SName, a.Addr_Street, a.Addr_City, b.Description, a.Addr_Zip, a.PhoneNbr, a.WebAddr, a.Latitude, a.Longitude, a.NoReviews, a.LastReview, a.AverageReview FROM spot a
LEFT JOIN cd_states b on a.Addr_State = b.Code
WHERE SpotID = 1

Edited by jrotunda85: n/a

Attachments sql.png 12.37 KB
2
Contributors
4
Replies
8
Views
6 Years
Discussion Span
Last Post by jrotunda85
0

On another weird note, when I run the following it returns all fields (including Longitude) but when I run the second statement, it gives me the same #1054 error

Statement 1 (Returns Everything)

SELECT * FROM spot WHERE SpotID = 1

Statement 2 (Returns #1054 Error)

SELECT Latitude FROM spot WHERE SpotID = 1
0

Try another interface than phpMyAdmin, e.g. command line mysql. I assume that phpMyAdmin twiddles your query. Look in the server log what the actual query is which the server complains about.

0

Try another interface than phpMyAdmin, e.g. command line mysql. I assume that phpMyAdmin twiddles your query. Look in the server log what the actual query is which the server complains about.

Well the whole reason I even asked was because when I'm trying to use this query from PHP it's not returning the value. So it's not working in PHP either - I'll check the logs though and see if I can find anything else.

0

Well, after fooling around with this last night, I just went ahead and upgraded to the newest version of mySQL (5.1.55) and it's working with the same query above. So I'm guessing it was a bug possibly in the earlier version that was fixed later in development.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.