Archery icon indicating copy to clipboard operation
Archery copied to clipboard

修复sql查询报错问题

Open woshiyanghai opened this issue 1 year ago • 3 comments

测试表结构 CREATE TABLE yhtest ( id INT(11) NOT NULL AUTO_INCREMENT, yhtest_code INT(10) DEFAULT NULL, tracking_code VARCHAR(45) DEFAULT NULL , status VARCHAR(40) DEFAULT NULL, status_details VARCHAR(255) DEFAULT NULL , status_date VARCHAR(15) DEFAULT NULL , tracking_location VARCHAR(255) DEFAULT NULL, in_dtm INT(10) DEFAULT NULL , PRIMARY KEY (id) USING BTREE ) ENGINE=INNODB DEFAULT CHARSET=utf8

实现一个组内排序取前几名的sql SELECT yhtest_code, STATUS, status_details FROM ( SELECT *, IF( @p=yhtest_code, CASE WHEN @s=status_date THEN @r WHEN @s:=status_date THEN @r:=@r+1 END, @r:=1 ) AS ran, @p:=yhtest_code FROM yhtest ,(SELECT @p:=NULL,@s:=NULL,@r:=0)r WHERE yhtest_code IN ('11111111') ORDER BY yhtest_code,status_date DESC )s GROUP BY yhtest_code;

查询报错:无法校验查询语句权限,请联系管理员,错误信息:'Schema'

woshiyanghai avatar Jan 04 '24 08:01 woshiyanghai

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (0cc0dd6) 76.97% compared to head (d5483bd) 76.97%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2474   +/-   ##
=======================================
  Coverage   76.97%   76.97%           
=======================================
  Files         115      115           
  Lines       15945    15945           
=======================================
  Hits        12274    12274           
  Misses       3671     3671           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 04 '24 08:01 codecov[bot]

是重提了这个 pr 吗? https://github.com/hhyo/Archery/pull/2332

LeoQuote avatar Jan 24 '24 04:01 LeoQuote

是重提了这个 pr 吗? #2332

不是,是为了解决下sql查询找不到schema的报错

woshiyanghai avatar Jan 24 '24 05:01 woshiyanghai