【发布时间】:2022-01-06 12:29:34
【问题描述】:
表 1: https://i.stack.imgur.com/XVyYf.png
表2: https://i.stack.imgur.com/762uM.png
期待结果: https://i.stack.imgur.com/lNssy.png
如果数组[R80,R01,R02,R03,R04,R05...] 和 'Table2' 中有很多数据, 所以我想在数组中找到'Table2'数据 结果必须“日期”是新的(DESC)/限制 1
示例:
点赞select * from tabel2 where ID = 'R80' DESC Date Limit1
但我想获得所有物品[R80,R01,R02,R03,R04,R05...]
点赞select * from tabel2 where in [R80,R01,R02,R03,R04,R05...] DESC Date Limit1??
请帮忙~谢谢
最好不要使用“循环,声明,@”
Please dont answer
select * from tabel2 where ID = 'R80'...;
select * from tabel2 where ID = 'R01'...;
select * from tabel2 where ID = 'R02'...;
...
【问题讨论】:
-
您对此有何疑问?有什么不适用于
WHERE ID in [a,b,c]? -
您使用的是哪种 DBMS 产品? “SQL”只是所有关系数据库使用的一种查询语言,而不是特定数据库产品的名称(并非所有支持数组)。请为您使用的数据库产品添加tag。 Why should I tag my DBMS
标签: sql oracle greatest-n-per-group