早上好,
我有一个包含三个表的mysql数据库:
我的下面的查询效果很好,这有助于我在下面的图片4中生成legder报告:
buttonName.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
labelName.setText("blah blah blah");
//and whatever else you may need to do
}
});
答案 0 :(得分:0)
可以通过union stockin
和stockout
表来实现。您还可以对不同类型的事务使用负值和正值。例如:
(SELECT StockIn_date AS `Date`, Product_code, Qty_In AS Qty, Uprice_In AS Uprice, Qty_In*Uprice_In AS Amount, 'StockIn' AS `Type`
FROM stockin)
UNION ALL
(SELECT StockOut_date AS `Date`, Product_code, -Qty_Out AS Qty, Uprice_Out AS Uprice, -Qty_Out*Uprice_Out AS Amount, 'StockOut' AS `Type`
FROM stockout)
ORDER BY `Date`;