如何查询季度日期涵盖的记录 [英] How to query records covered by quarter date

查看:53
本文介绍了如何查询季度日期涵盖的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

晚安!我有这个表格,用户/编码人员可以选择代理商及其项目,还有一个组合框,他必须在一年中的第一,第二,第三,第四季度选择该组合框.如果选择第一",则该代理机构的所有交易都应在1月到3月之间列出.

Goodday! I have this form where the user/encoder can select agency and its project, and a combobox which he has to select if First, Second, Third, Fourth Quarter of the year. When First is selected, all transactions of that agency should be listed from January to March.

SELECT ctrl_no, a_code, prj_code
FROM tbltrans
where date_created >=('1 January 2012')
and date_created <= ('31 March 2012')





Thanks!

推荐答案

在执行任何操作之前,您需要使用 TO_CHAR [日期时间格式元素 [
Before you can do anything you need to convert the text to a date using TO_DATE[^].
With the date you can use TO_CHAR[^] to get the quarter in which the date belongs.
Both functions use Datetime Format Elements[^].
SELECT ctrl_no, a_code, prj_code
FROM tbltrans
WHERE TO_CHAR( TO_DATE( date_created, 'DD Month YYYY', 'nls_date_language = us' ), 'Q') = '1'


使用DatePart函数.请参见此处 [
use DatePart function. See here[^]


这篇关于如何查询季度日期涵盖的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆