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

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

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.

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.