SELECT 'V' , Voucher_No, Voucher_Prefix, 'GodownTransfer',  Voucher_Date as 'Voucher Date',  CONCAT(Voucher_Prefix, '-', Voucher_No) as 'Voucher No' ,(select godown_name from $master_db.godown where godown_id = From_Location ) as 'From Location', (select godown_name from $master_db.godown where godown_id = To_Location ) as 'To Location' FROM $trans_db.Godown_Tranfer_Main som WHERE str_to_date(concat(Voucher_Date,' ',CAST(`TimeStamp` AS TIME)),'%Y-%m-%d %H:%i:%s') >= str_to_date('$fromDateTime','%Y-%m-%d %H:%i:%s') AND str_to_date(concat(Voucher_Date,' ',CAST(`TimeStamp` AS TIME)),'%Y-%m-%d %H:%i:%s') <= str_to_date('$toDateTime','%Y-%m-%d %H:%i:%s')