subtract 2 column value

Reply

Join Date: Mar 2009
Posts: 5
Reputation: kazitula is an unknown quantity at this point 
Solved Threads: 0
kazitula kazitula is offline Offline
Newbie Poster

subtract 2 column value

 
0
  #1
Mar 11th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,146
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: subtract 2 column value

 
0
  #2
Mar 12th, 2009
i think simple subtract will do that for you.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 2
Reputation: Juniour is an unknown quantity at this point 
Solved Threads: 0
Juniour Juniour is offline Offline
Newbie Poster

Re: subtract 2 column value

 
0
  #3
Oct 5th, 2009
Originally Posted by debasisdas View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,146
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic
 
0
  #4
Oct 6th, 2009
what you get when you try the following

  1. SELECT purchase,sales,purchase-sales AS balance FROM table_name
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 10
Reputation: Drlionheart is an unknown quantity at this point 
Solved Threads: 1
Drlionheart Drlionheart is offline Offline
Newbie Poster
 
0
  #5
Oct 13th, 2009
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.
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 2377 | Replies: 4
Thread Tools Search this Thread



Tag cloud for Oracle
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC