How can I create new column that takes the date from another column to get a datediff value.

How can I create new column that takes the date from another column to get a datediff value.

arlowarlow Posts: 6Questions: 3Answers: 0

I have the datatable being populated with the data in the query below except the 'Aging' column, which I can not figure out how to accomplish using datatabIes.

I need to create a new column in the Datatable that takes the date from one specific column "Sales Date" then performs DATEDIFF(curdate(), sales_date) as 'Aging' which will then populate the new column with the aging data.

Any ideas/help would be appreciated.

This is the actual query:
$sql_vehicle = mysqli_query($link_vehicles,"SELECT a.bos_number, a.sales_date, b.company, a.make, a.model, a.year, a.mileage, a.serial, a.cost, DATEDIFF(curdate(), a.sales_date) as 'Aging'
from vehicles a, users b
where a.buyer_number=b.bid_number and b.company!='company' limit 10");

Answers

This discussion has been closed.