如何从两列获取记录

时间:2013-09-08 07:39:24

标签: mysql sql

我有一个表名Vouchers,其中有三列名为“GroupName”,“LedgerName”和“Amount”。

enter image description here

我有另一个名为Accounts的表,其中我有两列“Name”和“Amount”,现在我希望列“Name”具有来自Vouchers表的GroupName,然后是具有相同GroupName的所有LedgerName属于那个记录。图像解释了我上面提到的问题

enter image description here

1 个答案:

答案 0 :(得分:0)

这不是ORDER BY操作吗?

我认为你不能以这种格式得到你的结果。但是使用ORDER BY操作,您可以获得类似的输出,但需要额外的列。 :)