2017-06-05 70 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

相關問題