MS Access 2003 中 IN 子句中的元组
我想在MS Access 2003(或者只是VBA中的sql)中进行查询,该查询将有一个IN子句处理元组,即,
我必须包含年和月列,并且我想使用IN子句提取例如2010-10和2012-03。为了在 Postgres 中进行比较,它看起来像
SELECT * FROM my_table WHERE (year, month) IN (("2010","10"),("2012","03"));
,但在 Access 中对我不起作用。是的,我将年份和月份都存储为文本,但这并不重要。
我知道我可以使用许多 AND 和 OR 来编写它,或者使用临时表进行 LEFT JOIN 。但这些查询是通过编程方式创建的,所以我想让它尽可能简单。
I wanted to make a query in MS Access 2003 (or just sql in VBA) which would have an IN clause working on tuples, i.e.,
I have to columns with year and month, and I would like to extract for example 2010-10 and 2012-03 using IN clause. For comparison in Postgres it would look like
SELECT * FROM my_table WHERE (year, month) IN (("2010","10"),("2012","03"));
but it does not work for me in Access. Yes, I store both year and month as text, but it really does not matter.
I know I could write it using many AND and OR, or make a LEFT JOIN with a temporary table. But those queries are created prograYmatically, so I wanted to make it as simple as possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
怎么样:
How about: