以下查询未在mysql中运行
SELECT (@a:=@a+1 ) AS sl, student_id, student_name, schl_id, class_id FROM `trans_student` AS TS, **(SELECT @a:=0) bas** WHERE TS.status= 1 AND `academic_year` = '2016-2017' ORDER BY sl ASC LIMIT 0,15
但这正在运行
SELECT (@a:=@a+1 ) AS sl, student_id, student_name, schl_id, class_id, academic_year,way, route_name, bus_driver, bus_phone FROM `trans_student` TS
INNER JOIN trans_route TR ON TS.route_id = TR.route_id
LEFT JOIN trans_bus TB ON TS.bus_id = TB.bus_id,
**(SELECT @a:=0) AS B**
WHERE TS.status= 1 AND `academic_year` = '2016-2017' ORDER BY sl ASC LIMIT 0,15;
你可以帮助我让第一个查询运行吗?动态列作为序列号的一些问题,但第二个查询工作正常,添加了一些内连接和左连接。
答案 0 :(得分:0)
def gameLoop():
while gameOver == True:
// Show game over screen
while gameExit == False:
// Runs the game
// Can set gameOver variable to true
当把动态表放在第一位就行了..谢谢
答案 1 :(得分:0)
此查询:
SELECT (@a := @a + 1 ) AS sl, student_id, student_name, schl_id, class_id
FROM `trans_student` TS,
(SELECT @a := 0) bas
WHERE TS.status = 1 AND
`academic_year` = '2016-2017'
ORDER BY sl ASC
LIMIT 0, 15;
从我能说的来看,这是好的。我不喜欢FROM
子句中的逗号,因此我会将,
替换为CROSS JOIN
。并且,我无法保证表名和列,但使用变量很好。
请注意,**
不应出现在查询中。错误消息表明这些字符在查询中。