Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从日期中提取月份中的某一天,并在 Informix SQL 中只选择奇数天?
月份中的日期只是DAY(date_or_datetime_column)函数,与MONTH()和YEAR()函数相关。仅获取奇数是通过简单的模 2 表达式完成的。
DAY(date_or_datetime_column)
MONTH()
YEAR()
所以我认为你只需要:
SELECT date_col, DAY(date_col) FROM table WHERE MOD(DAY(date_col), 2) = 1
希望这很有用。