mysql = classConn::connection();
// here is sql query
sql = "select p.productname, p.rate, b.quantity, b.total, b.billno, c.customername, c.contactaddress, c.mobileno, c.id as CustomerID from tableProductRecords as p, tableBilling as ";
sql += "b, tableCustomers as c where b.dateofsale = '"+ strdate+"' and p.productname in ( select productname from tableProductRecords where productid = ";
sql += "b.productid ) and c.customername in (select customername from tableCustomers where billno = b.billno) order by b.billno;";
draw->gotoxy(10, lines + 15);
cout << "Grand total : " << gtotal;
now problem is that sql query returns unwanted rows. as in these pics. here cutomer id "2" is not included in billno = 18, customer id 2 is having bill no 2 not 18 butit customerid 2 is showing in billno with 18. how to get only rows that have correct billno and customer id.
sorry for line indentation in my pc formats is not working
one last thing howto upload images
what I would do is print the generated sql statement and run it in your sql tool.
fix and debug it there, and keep track of the changes so you can fix the c++. Once you have it working outside the c++, fix the c++ to generate it exactly as it was when it worked.