How to multiply a variable value with a fixed value ?
I have this query:
SELECT DATEDIFF(`expiry_date`,NOW()) AS days FROM `tab_subscriptions` WHERE `user_id` = '[user_id]';
This allow me to get the remaining day before end of user subscription. Now I would like multiply the remaining day by the fixed value 0.25. So in practice if 300 days remain X 0.25, the query must return 75.
Somebody can tell me the correct syntax ?? I don't see how to do my calculation in the code...
thank in advance for your time
Last edited by dotcom22; 02-12-2014 at 01:37 PM.
Something like this, maybe?
SELECT DATEDIFF(`expiry_date`,NOW()) * 0.25 AS days FROM `tab_subscriptions` WHERE `user_id` = '[user_id]';
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
You rock you made my day !!!
I did not think it was as simple and your solution work as expected.
Many thank and all the best to you
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)