如何从两个表中获取不同的列

编程入门 行业动态 更新时间:2024-10-28 06:35:27
本文介绍了如何从两个表中获取不同的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有两个桌子- 表格-项目付款时间表 栏-ppsID,里程碑,完成日期,计费日期,billingrupees,projectid 数据集ds1; 表格-projectpaymentreceipt- 栏-pprID,收据日期,收据金额,projectid 数据集ds2;

Hi, I have two tables- TABLE - projectpaymentschedule COLUMN - ppsID,milestone,completiondate,billingdate,billingrupees,projectid dataset ds1; TABLE - projectpaymentreceipt- COLUMN - pprID,receiptdate,receiptamount,projectid dataset ds2;

ds1.merge(ds2);

我希望这些列位于网格视图中. 我采用两个数据集并尝试合并,但输出位于不同的行中. 就像第一数据集数据位于第一行,第二数据集数据位于第二行. 如果两个表中都有2行,我只希望两行中有数据.

i want these columns in a grid view. i take two data set and try to merge but output is comes in different rows. like first data set data is comes in first row and second data set data is comes in second row. if there is 2 rows in both tables i want data only in two rows. Thanks in Advance.

推荐答案

有很多因素和选项会影响新数据如何合并到现有的DataSet中.请记住相同的内容. 以下链接可能会帮助您: msdn.microsoft/en-us/library/aszytsd8.aspx [ ^ ] stackoverflow/questions/9107231/how-to-merge-two-datatable- contains-different-column-based-on-condition [ ^ ] 您还可以尝试使用相同的数据集和Diferent表. 与以下链接相同: csharp-informations/dataset/dataset-merge-sqlserver.htm [^ ] There are Several factors and options affect how new data is merged into an existing DataSet.Keep in mind the same.. following link may help you: msdn.microsoft/en-us/library/aszytsd8.aspx[^] stackoverflow/questions/9107231/how-to-merge-two-datatable-containing-different-column-based-on-condition[^] U can Also Try with Same dataset and Diferent tables. same as below link: csharp-informations/dataset/dataset-merge-sqlserver.htm[^]

您可以根据业务逻辑使用T-SQL使用INNER JOIN或union来实现 在此处检查 [ ^ ] 或 在此处检查 [ ^ ] 最好的问候 M.Mitwalli Hi, You can make it using T-SQL using INNER JOIN or union according to your business logic Check here[^] or Check here[^] Best Regards M.Mitwalli

sbSql.Append("select a.milestone,apletiondate,a.billingdate,a.billingrupees,a.projectid, b.receiptdate,b.receiptamount from projectpaymentschedule a join projectpaymentreceipt b on a.projectid = b.projectid where a.projectid = @projectid");

更多推荐

如何从两个表中获取不同的列

本文发布于:2023-10-27 18:21:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534164.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两个

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!