我需要写一个set和select组合的查询:
类似这种:
SET @row_num = 0, @group = '';
SELECT * FROM (
SELECT *,
@row_num := IF(@group = CONCAT(id, user), @row_num + 1, 1) AS row_num,
@group := CONCAT(id, user)
FROM xxx_record
WHERE id = 'your_id'
ORDER BY id, user, update_time DESC
) subq
WHERE row_num <= 5;
我用Sqls.create()方式构建NutSql 然后执行,一开始报错是是把这个语句当成Other了,显式设置为SqlType.Select
还是报错,好像jdbc不支持这种复合语句查询?有没有执行复合语句的方法?