我有两张桌子:
现在我试图从表2字段"名称"这等于表1中的eo_venue_id。例如,在表1中,eo_venue_id的值为29,因此我需要获取字段" Name"从表2中,term_id是29.我需要将所有这些数据导出到csv,列应该是:
姓名| _city | _address
我该怎么做?
好的,我有这个:
SELECT DISTINCT
name
,(SELECT meta_value FROM wp_eo_venuemeta WHERE wp_eo_venuemeta.meta_key = '_address' AND wp_eo_venuemeta.eo_venue_id = wp_terms.term_id) as "Adres"
,(SELECT meta_value FROM wp_eo_venuemeta WHERE wp_eo_venuemeta.meta_key = '_city' AND wp_eo_venuemeta.eo_venue_id = wp_terms.term_id) as "City"
FROM wp_terms
ORDER BY
name
可以吗?现在,如何将其导出为CSV?