如何获得多行值 [英] How to get Multiple Row Values

查看:28
本文介绍了如何获得多行值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我旧帖子的延续问题.如果您想查看下图的代码,请点击以下链接,并解决我的问题.

It is the question in continuation to my old post. If you want to see the codes of the below image then follow the below link, and solve my problem please.

如何将两个列的值相乘并在每行的末尾显示其结果?

stackoverflow.com/questions/11202617/how-to-multiply-two-column-values-and-display-its-result-at-the-end-of-each-row/11203135

stackoverflow.com/questions/11202617/how-to-multiply-two-column-values-and-display-its-result-at-the-end-of-each-row/11203135

图片

http://www.koolfree.com/ImageUpload/uploads/1341093148.jpg

问题

我附上了截图的链接.请查看屏幕截图并告诉我如何为每个用户 ID 添加多个作业?

I have attached a link of Screenshot. Kindly see the Screenshot and tell me how can I add multiple jobs per user ID?

例如,屏幕截图具有用户 ID 216020,并且用户有两行 工作地点,即 CivilOffice Workstrong>,它有两行 Salary,即 150200,它有两行 Allowance,即 00,它有两个 Days 行,即 1713,最后它有两个Total 行即 19502600(Total 是通过 Salary 和 Days 的乘法生成的)并且在末尾有一个 Total of Total桌子.我无法为每个用户 ID 获取多个行值.请告诉我如何获取每个用户 ID 的行值?

For Example, Screenshot have User ID 216020 and the user has Two Job Locations rows i.e. Civil and Office Work, it has Two Salary rows i.e. 150 and 200, it has Two Allowance rows i.e. 0 and 0, it has Two Days rows i.e. 17 and 13, finally it has Two Total rows i.e. 1950 and 2600 (Total is generated through the Multiplication of Salary and Days) and there is a Total of Total at the end of the Table. I am not able to get multiple row values per user ID. Kindly tell me how can I get those row values per User ID?

推荐答案

Given MyTable of ID,A1,A2,B1,B2,C1,C2

Given MyTable of ID,A1,A2,B1,B2,C1,C2

然后就是这样

Select ID,A1 AS Value1 ,B1 as Value2 ,C1 AS Value3
From MyTable
Union All
Select ID,A2,B2,C2
From MyTable

当然???

这篇关于如何获得多行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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