mysql - Mysql在日期位于日期集中的条件下选择
问题描述
我的选择命令:
select * from wp_ved_currencies where date in (select DISTINCT date from wp_ved_currencies order by date desc limit 2);
错误信息:
Error
SQL query:Documentation
select * from wp_ved_currencies where date in (select distinct date from wp_ved_currencies order by date desc limit 2) LIMIT 0, 50
MySQL said:Documentation
#1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
你能帮帮我吗?
解决方案
您应该可以在此处加入限制子查询:
SELECT w1.*
FROM wp_ved_currencies w1
INNER JOIN
(
SELECT DISTINCT date
FROM wp_ved_currencies
ORDER BY date DESC
LIMIT 2
) w2
ON w1.date = w2.date;
推荐阅读
- html - Chrome不在扩展程序中显示本机选项对话框
- c++ - 在 VS2019 中使用 clang-cl 构建项目
- html - 如何设置 div 高度等于它的 div 高度?
- terraform - Tearraform:无法指出在同一循环中创建的父资源并出现循环错误
- sql-server - 从 SQL 数据库重写 URL - 有人有工作模型吗?
- google-apps-script - 在多个触发器上存储数组值
- jquery - 我讨厌这种重复,但我该如何解决它-jquery,bootstrap 4 datepicker
- sqlalchemy - 与泛型 fk 的泛型关联:无法摆脱重叠警告
- reactjs - 在 Docker 容器中运行的 NextJS 无法识别自定义 React Hooks
- python - Python paramiko 线程安全吗?