我试图从我的两个表中获取一些用户数据。知道什么是错的吗?任何帮助表示赞赏。
错误讯息:
未知栏' a3p_user_fields.user_id' i tabel字段列表
我的表格:
**a3p_user_fields**
user_id,
field_title,
field_job_title,
field_education,
field_experience,
field_hourly_wage,
field_support,
field_fee,
field_description,
**a3p_usermeta**
umeta_id,
user_id,
meta_key,
meta_value
我的查询:
SELECT `a3p_user_fields.user_id`, `a3p_user_fields.field_job_title`,
`a3p_user_fields.field_education`, `a3p_user_fields.field_experience`,
`a3p_user_fields.field_hourly_wage`, `a3p_usermeta.meta_key` FROM
`a3p_user_fields` INNER JOIN `a3p_usermeta`
ON `a3p_user_fields.user_id` = 'a3p_usermeta.user_id`
WHERE `a3p_user_fields.field_title` = 'Gartner'
AND `a3p_usermeta.meta_key` = 'candidate_flexjob' AND `a3p_usermeta.metavalue` = 'Ja'
ORDER BY `a3p_user_fields.user_id` ASC
答案 0 :(得分:0)
问题出在以下几行,我认为这是一个引用问题
ON `a3p_user_fields.user_id` = 'a3p_usermeta.user_id`
你的意思是
ON `a3p_user_fields`.`user_id` = `a3p_usermeta`.`user_id`
您选择列的方式也不正确,如
SELECT `a3p_user_fields.user_id`
您应该单独引用表名和列名
SELECT `a3p_user_fields`.`user_id`