Is it ok to use a querry like this.. SELECT sum(tbl_customerledger.pieces*tbl_purchase.price)'cost' FROM tbl_customerledger,tbl_purchase,tbl_customers where tbl_customerledger.code=tbl_purchase.code and tbl_customers.no=tbl_customerledger.customerno and tbl_customers.branch='$branchname' and tbl_customerledger.date>=$date My project uses this query and is working fine, but was wondering whether this could be a problem in long run because each of those tables could run up to a million entries or more easily. Can mysql handle this sort of queries, in tables with lot of data?
should be ok work if you put correct indexes on the tables for the columns where you join on / filter on (don't forget to have an index that includes tbl_customerledger.date and tbl_customerledger.customerno as you filter on the date) as long as your query uses indexes and doesn't start table scans you don't have to worry..