March 6th, 2013, 05:19 AM
Sql query - select * and apply dateadd to 2 columns
I am a proper beginner in the world of sql, so i will be really thankful if someone can help me with my problem.
I am trying to display all columns from a table and apply some formatting(formula) to only 1 maybe 2 of them.
apply: DATEADD(day,CURDATE/1440, '01/01/1988')
SELECT * and apply FROM tableONE
I hope this makes sense! Cheers
March 6th, 2013, 06:38 AM
nope, sorry, it doesn't
Originally Posted by mehow
and it looks like you're not using mysql, so i've moved your thread to the MS SQL forum
March 6th, 2013, 06:44 AM
I have not designed the database I am working with. I am using 'Priority 15's database.
the conversion is done with this statement : DATEADD(day,CURDATE/1440, '01/01/1988')
I will try to explain this again.
There is a table called TableOne
There are 3 columns in TableOne - NAMEA, CURDATE, NAMEB
NAMEA is VARCHAR(20)
CURDATE is BIGINT datatype ( value 13163040 represents 10/01/2013 )
NAMEB is VARCHAR(20)
Now, if I wanted to display all columns from TableOne so SELECT * FROM TableOne
But, if I wanted to apply this: DATEADD(day,CURDATE/1440, '01/01/1988') to column CURDATE and then display all columns - then how do i do that?
display result would be :
NAMEA, CURDATE, NAMEB
but CURDATE column ( all values ) are not 13163040 but dd/mm/yyyy
March 6th, 2013, 07:09 AM
, DATEADD(DAY,CURDATE/1440,'01/01/1988') AS curdate