我从这个查询中得到了错误的列名......例如,我得到了meta_value
“resource_email”和“resource_phone”单元格的列名......它们的列名都是meta_value
SET @centerLat = '48.428289';
SET @centerLng = '-123.380585';
SELECT wp_posts.*, resource_email.meta_value, resource_phone.meta_value,
( 3959 * acos( cos( radians( @centerLat ) ) * cos( radians( lat.meta_value ) ) * cos( radians( lng.meta_value ) - radians(@centerLng) ) + sin( radians( @centerLat ) ) * sin( radians( lat.meta_value ) ) ) ) AS distance
FROM wp_posts
LEFT JOIN wp_postmeta AS lat
ON lat.post_id = wp_posts.id
AND lat.meta_key = 'bid_resource_lat'
LEFT JOIN wp_postmeta AS lng
ON lng.post_id = wp_posts.id
AND lng.meta_key = 'bid_resource_lng'
LEFT JOIN wp_postmeta AS resource_email
ON resource_email.post_id = wp_posts.id
AND resource_email.meta_key = 'bid_resource_primary_email'
LEFT JOIN wp_postmeta AS resource_phone
ON resource_phone.post_id = wp_posts.id
AND resource_phone.meta_key = 'bid_resource_primary_phone'
HAVING distance < 5
LIMIT 0 , 20
不确定我需要如何更改此查询才能获得我真正需要的列名。