如何从两个表中获取不同的列 [英] how to get different columns from two tables

查看:99
本文介绍了如何从两个表中获取不同的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个桌子-
表格-项目付款时间表

栏-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中.请记住相同的内容.
以下链接可能会帮助您:

http://msdn.microsoft.com/en-us/library/aszytsd8.aspx [ ^ ]


http://stackoverflow.com/questions/9107231/how-to-merge-two-datatable- contains-different-column-based-on-condition [ http://csharp.net-informations.com/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:

http://msdn.microsoft.com/en-us/library/aszytsd8.aspx[^]


http://stackoverflow.com/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:

http://csharp.net-informations.com/dataset/dataset-merge-sqlserver.htm[^]



您可以根据业务逻辑使用T-SQL使用INNER JOIN或union来实现
在此处检查 [在此处检查 [
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,a.completiondate,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");


这篇关于如何从两个表中获取不同的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆