Home > database > ORACLE SQL statement questions beg god for help
ORACLE SQL statement questions beg god for help
Time:09-29
Select a from alarm a Have a date type field in the table, I want to take out the alarm watch all of the fields at the same time, take the date a value type fields hour, can you tell me how to write a great god?
CodePudding user response:
A fool writing Select a date alarm a where clause date_col in (select min (date_col) from alarm)
CodePudding user response:
select a. *, to_char (a. d. ate_col, 'hh24) hh from alarm a;
I understand is that, in all the fields in the table, then add a single hour field?
CodePudding user response:
SQL> The select to_char (sysdate, 'hh24), sysdate from dual;
The TO SYSDATE -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 14 the 2016-11-29 14:40:07
SQL> The select to_char (sysdate, 'hh), sysdate from dual;
There is a stupid question - date if normal to bring back local, how only for hours, in Java
CodePudding user response:
Forgot to say the first question, because I am using hibernate, entity class involved too much because it is over, I don't want to change the type of entity class, so I want to ask is whether I can take in alarm list of all the data at the same time to take a single date and only take hours,
Now I want to do is to date type directly retrieve the local don't do processing, want to separate for hours in a Java background, I consult a great god,