我有以下查询,我在哪里计算行号:
SELECT @rank := @rank + 1 AS rnkk, tdate, billno, party_name, net_total, pid FROM purchase_bill_wise , (SELECT @rank := 0) rnk;
完美地返回行号。当我在查询中放置where子句时会出现问题,如下所示:
SELECT @rank := @rank + 1 AS rnkk, tdate, billno, party_name, net_total, pid FROM purchase_bill_wise WHERE tdate = '2013-09-18' , (SELECT @rank := 0) rnk;
我收到错误代码:1064
答案 0 :(得分:1)
交叉联接应该在select ... from table_name
SELECT
@rank := @rank + 1 AS rnkk,
tdate,
billno,
party_name,
net_total,
pid
FROM purchase_bill_wise,(SELECT @rank := 0) rnk
WHERE tdate = '2013-09-18'
;