hi
I have got a table for internet accesswith user ID, it has 3 column user ID, starttime and endtime, i want to make another column which will show how many mins or hours that user was logged in to the internet. can anyone please help me...
thanks
kaz

Recommended Answers

All 3 Replies

i wouldn't suggest adding an additional column necessarily, but creating a view, that way, your duration will always be in sync with the columns

select USER_ID, START_TIME, END_TIME,
DATE_DIFF(second, START_TIME, END-TIME) AS DURATION_SEC
FROM
InternetAccess

depending on what you need, you can sub in minute, hour, or second amongst others for the datediff

hi thanks for the reply. but i tired this and it says

"SQL Error: ORA-00904: "DATEDIFF": invalid identifier
00904. 00000 -  "%s: invalid identifier"
*Cause:    
*Action:"

can you please check it?
thanks.

you posted this in the mssql forum, are you using oracle then?

if so, post in there

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.