Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query

Status
Not open for further replies.

vhalle

Programmer
Dec 7, 2015
1
CA
Is there any way to merge two column into one temporary column?

ex: I have Hours and minutes, I want to merge the 2 of them to get Time

I then want to do a query using Time

Thank you
 
By 'merge' you mean 'concatenate' ?
How about:
[tt]
Select Hours || ':' || Minutes As MyTime
From Sometable[/tt]

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Also, you should never store a date or time as characters. They should ALWAYS be stored as a date column. If they are already a date, then the column already contains the date and time. If you are on a later version of the database, setup a virtual column containing an actual date column. It could then be used for reporting and sorting purposes.

Bill
Lead Application Developer
New York State, USA
 
expanding on Andy's code

Select TO_CHAR(Hours) || ':' || TO_CHAR(Minutes) As MyTime From Sometable

Or use a TO_DATE statement to convert to that data format.

==================================
adaptive uber info galaxies (bigger, better, faster, and more adept than cognitive innovative agile big data clouds)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top