2017-06-05 77 views
-2

我对查询有点奇怪的问题。此查询工作:MySQL - 错误代码:1054.'on子句'中的未知列'task_log_wip.task_log_task'

SELECT task_log_wip.* 
FROM task_log_wip 
INNER JOIN tasks ON tasks.task_id = task_log_wip.task_log_task; 

但此查询不起作用:

SELECT task_log_wip.*, xmlform.* 
FROM task_log_wip, xmlform 
INNER JOIN tasks ON tasks.task_id = task_log_wip.task_log_task; 

添加任何类型的表格可以选择并会产生以下错误:

错误代码:1054。 'on子句'中的未知列'task_log_wip.task_log_task'

task_log_wip结构:

task_log_id 
task_log_task 
task_log_name 
task_log_description 
task_log_creator 
task_log_hours 
task_log_date 
task_log_costcode 
task_log_xmlform_id 
task_log_xmldoc 
task_log_uniqueid 
task_log_javascript_executed 
task_log_fm_related_date 
task_log_draft 
task_log_status 
task_log_approver 
task_log_approval_date 
task_log_pre_delete_status 
task_log_deletion_approver 
task_log_deletion_date 
task_log_orig_creator 
task_log_wip_auto_save 
task_log_orig_created 

任务结构:

task_id 
task_name 
task_parent 
task_milestone 
task_project 
task_owner 
task_start_date 
task_duration 
task_duration_type 
task_hours_worked 
task_end_date 
task_status 
task_priority 
task_percent_complete 
task_description 
task_target_budget 
task_related_url 
task_creator 
task_order 
task_client_publish 
task_dynamic 
task_access 
task_notify 
task_departments 
task_contacts 
task_custom 
task_xmlform_id 
task_procedure 
task_virtual 
task_ypaccess 
task_created_ts 

xmlform结构(task_log_wipxmlform经由task_log_wip_xmlform_ ID连接):

xmlform_id 
xmlform_project_type 
xmlform_project_type_parent 
xmlform_type 
xmlform_name 
xmlform_description 
xmlform_dtd 
xmlform_edit_rule_value 
xmlform_company_id 
xmlform_department 
xmlform_creator_id 
xmlform_shared 
xmlform_notify_via_email 
xmlform_notify_via_sms 
xmlform_notify_via_pager 
xmlform_notify_via_instant_messenger 
xmlform_report_severity_level 
xmlform_hidden 
xmlform_released 
xmlform_restricted 
created_by 
created_timestamp 
last_updated_by 
last_updated_timestamp 
+0

您需要将表格xmlform与其他表格连接起来,或者如果您希望整个笛卡尔计划符合您的查询建议,则需要交叉连接它。 –

+0

无论哪种方式,没有足够的关于该表的信息来为您提供答案... –

+0

我应该提供哪些其他信息? – Sasha

回答

1

所以,你需要或者连接或左与xmlform表这样的JOIN:

SELECT task_log_wip.*, 
     xmlform.* 
FROM task_log_wip 
     INNER JOIN tasks 
      ON tasks.task_id = task_log_wip.task_log_task 
     INNER JOIN xmlform 
      ON xmlform.id = task_log_wip.task_log_wip_xmlform_id; 

的JOIN或LEFT JOIN选择将取决于您的数据和要求。

+0

这是工作:)。谢谢您的帮助 :) – Sasha

相关问题