You can get the date part of a date (without time), by using the TRUNC
function. TRUNC
will remove the time part.
The resulting value is still a date and you can use it to group by and format it as will.
I must admit that it's not exactly clear to me what type of value the field FQA_START_DATE is and what type the input variables are. It looks like they are all strings, but I would advise you to store dates as dates and also use date input parameters if possible.
So ideally, your query would look like this:
SELECT
FQA_START_DATE_WITHOUT_TIME,
DE_NO
FROM (
SELECT
trunc(FQA_START_DATE) as FQA_START_DATE_WITHOUT_TIME,
DE_NO
FROM P
ACKINGAPPS_FQA
WHERE
trunc(FQA_START_DATE) BETWEEN $start_date AND $end_date
)
GROUP BY
FQA_START_DATE_WITHOUT_TIME,
DE_NO
And if you are not going to need any other fields, extra joins or aggregations, you can simplify it to this:
SELECT DISTINCT /* Distinct will remove duplicate rows */
trunc(FQA_START_DATE) as FQA_START_DATE_WITHOUT_TIME,
DE_NO
FROM P
ACKINGAPPS_FQA
WHERE
trunc(FQA_START_DATE) BETWEEN $start_date AND $end_date
Note that this assumes FQA_START_DATE
to be a date/datetime field, assumes start_date
and end_date
to be dates/datetimes and will return a field FQA_START_DATE_WITHOUT_TIME
, which is also a date field.