这个有点难表述:

  • 有重复字段中不同key的行数

select count(*) from fund_netvalue group by fundcode

103908508.jpg

select distinct fundcode  from fund_netvalue

103959750.jpg

select count(*) from (select distinct fundcode  from fund_netvalue) as fund01

104049619.jpg

发现一种新的写法:

095518128.jpg

  • SQL语句中and or问题

  不多说吗,直接看图

164039223.jpg

正确写法:

#1
select * from frm_auditlog where (operation=3051 or operation=3061) and keyparam2='GCSPDB' limit 50
#2
select * from frm_auditlog where keyparam2='GCSPDB' and operation in (3051,3061) order by logdt desc