本文介绍了如何将五个表连接在一起,如果任何一个表填充而其他表为空,则整行必须作为输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 如何连接5个表,如果一个表被填充而其他表是空的,那么我们可以得到那一行。每个表都有包含月,年,日和T1的列 EX: MNTH年份日期T1 | OMNTH OYT2年$ 2 $ b 2017年1月22日/ 2017年CC | .... .... ......等......... 需要输出 明年年纪T1 T2 T3 T4 T5 JAN 2017 22/1/17 CC。 .. .. .. 这些按日期条件(日期tym piker)过滤 我尝试过: var qry = SELECT月,T1,T2,T3,T4,T5 来自T1 AS m 完全加入T2 AS o ON m.month = o.omonth和m.year = o.year FULL JOIN T3 AS s ON s.smonth = o.omonth and s.year = o.year FULL JOIN T4 AS t ON t.tmonth = m.month and t.year = m.year FULL JOIN T5 AS p on p.spmonth = o.omonth and p.year = o.year where m.date在' + dateTimePicker6.Value.ToString之间( yyyy / MM / dd)+ '和' + dateTimePicker5.Value.ToString( yyyy / MM / dd)+ ' 当两个或多个表被填满时,它加入表并仅提供输出。解决方案 how to join 5 tables and if one table is filled and others are empty,then we can get that row . Each tables have column with month ,year ,date and T1EX:MNTH YEAR DATE T1 | OMNTH YEAR DATE T2JAN 2017 22/1/17 CC | .... .... ... .. etc.........REQUIRED OUTPUT MNTH YEAR DATE T1 T2 T3 T4 T5 JAN 2017 22/1/17 CC .. .. .. ..these are filtered by condition of date (date tym piker)What I have tried:var qry = " SELECT month,T1,T2,T3,T4,T5 FROM T1 AS m FULL JOIN T2 AS o ON m.month = o.omonth and m.year=o.year FULL JOIN T3 AS s ON s.smonth = o.omonth and s.year=o.year FULL JOIN T4 AS t ON t.tmonth = m.month and t.year=m.year FULL JOIN T5 AS p ON p.spmonth=o.omonth and p.year=o.year where m.date between '" + dateTimePicker6.Value.ToString("yyyy/MM/dd") + "' and '" + dateTimePicker5.Value.ToString("yyyy/MM/dd") + "'"It joins the table and give only output when two or more tables are filled. 解决方案 这篇关于如何将五个表连接在一起,如果任何一个表填充而其他表为空,则整行必须作为输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-03 12:06