I have a DBGrid component of BDS 2006 in my application. The snapshot of the grid is as follows.
The DBGrid component is connected to a MySQL database, which gets populated at run time. The query I have used is:
dm.MyQpayment.SQL.Clear;
dm.MyQpayment.SQL.Add('select sdate,stime,pcid,billno,c.customer_name,s.customerid,s.total,s.amount_paid,s.balance');
dm.MyQpayment.SQL.Add(',s.payment_type,s.payment_status,s.delivery from sales_order s left join customer_details c on s.customerid=c.customerid where s.payment_status=''complete'' and s.sdate>="'+startdate+'" and s.sdate<="'+enddate+'" ');
dm.MyQpayment.Active :=true;
I want to dispaly BILL NO
and Machine id
as BILL NO
and the values should be 2_1, if Machine id
is 2 and BILL NO
is 1.
Any idea how to do that?
EDIT1
select CAST(pcid AS CHAR) + "_" + CAST(billno AS CHAR) AS MachineAndBillNo
FROM tt.payment_details ;
this query gives me result as follows
where it gives machineandbillno=billno+pcid
I do not know the specific MySQL syntax requirements, but you have to concatenate those two fields together:
SELECT
sdate,
stime,
CONCAT(CAST(pcid AS CHAR), '_', CAST(billno AS CHAR)) AS MachineAndBillNo,
c.customer_name,
...