我编写了一个sql查询,它根据条件从单个表(describe('Get file jobs', function() {
this.retries(3);
describe('More describe blocks', function() {
before('do something', function(done) {
// do something
done();
})
it('should GET /api/file/id', function(done) {
// do something
// should run three times if it fails
done();
})
})
})
)中提取数据,如下所示:
date,account,dr,cr
我想在表格的左侧显示借方数据,在右侧显示贷方数据。知道行可以不同的事实。但是,我通过查询得到了双重数据。
有人能帮助我吗?
答案 0 :(得分:0)
尝试以下查询
SELECT t1.*,t2.* FROM
(select date,account,dr from sys_credit_debit where dr != 0) as t1
INNER JOIN
(select date,account,cr from sys_credit_debit where cr != 0) as t2
ON t1.account = t2.account AND t1.date = t2.date