Mysql/Mariadb Effect date (Mr. Rao)

Post Reply
dagiayunus
Posts: 69
Joined: Wed Nov 19, 2014 1:04 pm
Contact:

Mysql/Mariadb Effect date (Mr. Rao)

Post by dagiayunus »

Dear Sir Mr.Rao

How we can set and use effective dates with mysql/mariadb for example

Item A Price 60 Rs from Dt.20/06/2017
Item A Price 80 Rs from Dt.24/06/2017


Thanks & Regards
Dagia Yunus.
Rajkot, India

FWH 17.04
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Mysql/Mariadb Effect date (Mr. Rao)

Post by nageswaragunupudi »

Code: Select all

function GetPrice( cItemID, dDate )

   local cSql

   cSql  := "SELECT date,price FROM prices WHERE itemid = ? AND IFNULL( date, '0000-00-00' ) <= ? ORDER BY date DESC LIMIT 1"
   cSql  := oCn:ApplyParams( cSql, { cItemID, dDate } )

return oCn:QueryResult( cSql )[ 2 ]

 
Regards

G. N. Rao.
Hyderabad, India
Post Reply