照会 - 取得の問題は、私は、以下のクエリで問題を取得しています
SELECT DISTINCT id
FROM wp_posts
INNER JOIN wp_postcodes ON (
wp_postcodes.post_id = wp_posts.id
AND wp_posts.post_type = 'listing'
AND TRUNCATE (
(degrees(acos(sin(radians(latitude)) * sin(radians('37.090240')) + cos(radians(latitude)) * cos(radians('37.090240')) * cos(radians(longitude - '-95.712891')))) * 69.09),
1
) <= 400
AND TRUNCATE (
(degrees(acos(sin(radians(latitude)) * sin(radians('37.090240')) + cos(radians(latitude)) * cos(radians('37.090240')) * cos(radians(longitude - '-95.712891')))) * 69.09),
1
) >= 40
)
INNER JOIN wp_postmeta ON (
wp_postmeta.post_id = wp_posts.id
AND wp_posts.post_type = 'listing'
AND wp_posts.post_status = 'publish'
AND (
(
meta_key = 'city'
AND meta_value = 'sports'
)
OR (
meta_key = 'state'
AND meta_value = 'sports'
)
OR post_title = 'sports'
)
)
INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
LEFT JOIN wp_terms ON (wp_terms.term_id = wp_term_relationships.term_taxonomy_id)
INNER JOIN wp_term_taxonomy ON (
wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND wp_term_taxonomy.taxonomy = 'listingcategory'
AND wp_term_taxonomy.term_id = 406
)
UNION
DISTINCT
SELECT DISTINCT id
FROM wp_posts
INNER JOIN wp_postcodes ON (
wp_postcodes.post_id = wp_posts.id
AND wp_posts.post_type = 'listing'
AND TRUNCATE (
(degrees(acos(sin(radians(latitude)) * sin(radians('37.090240')) + cos(radians(latitude)) * cos(radians('37.090240')) * cos(radians(longitude - '-95.712891')))) * 69.09),
1
) <= 400
AND TRUNCATE (
(degrees(acos(sin(radians(latitude)) * sin(radians('37.090240')) + cos(radians(latitude)) * cos(radians('37.090240')) * cos(radians(longitude - '-95.712891')))) * 69.09),
1
) >= 40
)
INNER JOIN wp_postmeta ON (
wp_postmeta.post_id = wp_posts.id
AND wp_posts.post_type = 'listing'
AND wp_posts.post_status = 'publish'
AND (
(
meta_key = 'city'
AND meta_value LIKE '%sports%'
)
OR (
meta_key = 'state'
AND meta_value LIKE '%sports%'
)
OR post_title LIKE '%sports%'
)
)
INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
LEFT JOIN wp_terms ON (wp_terms.term_id = wp_term_relationships.term_taxonomy_id)
INNER JOIN wp_term_taxonomy ON (
wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND wp_term_taxonomy.taxonomy = 'listingcategory'
AND wp_term_taxonomy.term_id = 406
)
は、ここではそれが組合と2つのクエリ、第一何も出力が、第二取得出力を取得しないを持っています。私は両方のクエリの和集合を実行しています。ここに結果があるはずです しかし、私は結果を得ていません。私が行っている間違いを提案してください。
これは怪物です!誰もがそれを理解したいと思う可能性が高い。何が起こっているのかを簡単に見られるように書式を設定してください。 – iblamefish
これは本当に最初のSELECTステートメントで、それが問題を与える部分であるため、分析する必要があります。最初のSELECT文だけを別々に実行しようとしましたか? – JNevill
あなたにエラーメッセージがありますか?あなたが@mysqlを持っていないことを確認してください...エラーメッセージを隠す – scaisEdge