Combaine两张桌子?

编程入门 行业动态 更新时间:2024-10-23 01:30:30
本文介绍了Combaine两张桌子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Select Row_Number() over (order by FeedType) SNo, FeedType from k_FPS_FeedType declare @DaVal as datetime --111 will return yyyy/MM/dd --101 will return MM//dd/yyyy set @DaVal = convert(datetime, convert(varchar(25), DATEADD(d,-1,GETDATE()), 111)) select rateperkg from K_FS_FeedMrpDetails where date = @DaVal

这些是表格,但我尝试在一张表中显示.. 怎么样?添加到一个表中,输出就像

These are tables ,but i try to it shows in one table.. how can add in one table,out put like

SNO FeedType Yeserdayrates 1 Breeder 32 2 Breeder1 25

推荐答案

除非两个表之间有链接(你没有显示)然后没有,你可以' t - 你需要有一个共同的列才能做到这一点。 例如: Unless there is a link between the two tables (which you don't show) then no, you can't - you need to have a column in common in order to do that. For example: tabInvoice ID Int, Identity INo Iny CompID Int

tabCompany ID Int CoName NVARCHAR(200)

tabInvoice:

tabInvoice:

ID INo CompId 1 10001 1 2 10002 1 3 10003 2

tabCompany

tabCompany

ID CoName 1 Jones Supplies 2 Mikes Bits 3 Gary Sells It

SELECT i.ID, i.INo, c.CoName FROM tabInvoice i JOIN tabCompany c ON i.CompId=c.CoName

将返回:

Will return:

ID INo CompName 1 10001 Jones Supplies 2 10002 Jones Supplies 3 10003 Mikes Bits

如果没有您桌子的详细信息,我们无法准确了解您的需求。 BTW:什么是数据转换的东西?很奇怪......

Without the detail for your tables, we can't be precise about what you need. BTW: What the heck is that data conversion stuff for? Very odd...

尝试UNION。 technet.microsoft/en-us/library/ms180026.aspx [ ^ ] Try UNION. technet.microsoft/en-us/library/ms180026.aspx[^]

更多推荐

Combaine两张桌子?

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

发布评论

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

>www.elefans.com

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