954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

subtract 2 column value

hi
I have got a table for "internet access" with user ID, it has 3 columns 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 and also add the total time if the user logged in more than once. can anyone please help me...
thanks
kaz

kazitula
Newbie Poster
5 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

i think simple subtract will do that for you.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 
i think simple subtract will do that for you.


Hi debasisdas,
i also have the same problem and have a mysql table with two columns 'purchases' and 'sales' and would like to have another column 'balance' which is the result of subtracting purchases from sales. I am newbie to MySQL, would you kindly explain more about the simple subtract?

I highly appreciate your help and anyone out there with good ideas.

Juniour
Newbie Poster
2 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

what you get when you try the following

select purchase,sales,purchase-sales as balance from table_name
debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

Hi

I Suggest you that it will not work through SQL Query only.

You have to create Proceduers or Packages to Update users previous logging time.

Drlionheart
Newbie Poster
10 posts since Oct 2009
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You