根据条件确定要连接的表 [英] Determine table to join based on the condition
问题描述
我不确定我是否错过了正确的搜索,但我无法得到确切的问题,因为我的
这是类似但不准确的
确定要加入的表格
实际上我想根据哪个表决定加入哪个表格场地价值基础
种类
从表1中选择*
左连接(table1.field = 1时的情况,然后是Table2,否则Table3结束)最终
Table1.Col1 = final.Col1上的
表2和表3有相同的结构
这是我的桌面细节,
i有3个表employee_master,employee_timing和designation_timing。现在,员工主人中有一个字段,即自定义时间。我想在employee_timing和designation_timing的基础上计算员工的时间,但是如果employee_master的字段customtime为true,那么在加入此表时有一个条件,那么我必须与表employee_timing一起加入其他明智的与assign_timing
I am not sure if I have missed to search properly, but I couldn't get the exact question as mine
This is something similar but not exact
DETERMINING WHICH TABLE TO JOIN TO
Actually I want to decide with which table to join based on the bases of field value
Kind of
select * from Table1
left join (case when table1.field=1 Then Table2 else Table3 end) final
on Table1.Col1 = final.Col1
Table2 and Table3 has same structure
Here is my table detail,
i had 3 tables employee_master ,employee_timing & designation_timing. now, there is one field in employee master i.e customizedtime. I want to calculate the time of employee on the bases of employee_timing & designation_timing but there is one condition while joining this table if employee_master's field customizedtime is true then i have to join with table employee_timing other wise with designation_timing
推荐答案
这里可以找到一个非常好的答案..
http://stackoverflow.com/questions/15989593/determine-table-to-join-based-on-the-condition [ ^ ]
A very good answer can be found here..
http://stackoverflow.com/questions/15989593/determine-table-to-join-based-on-the-condition[^]
这篇关于根据条件确定要连接的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!