define variable mysql as memptr no-undo. define variable mysql_res as memptr no-undo. define variable sql as character no-undo. {mysql-functions.i} db_connect(mysql). db_query(mysql,"use sports"). sql = "select name, state, invoice_num,total_paid from Customer a, Invoice b ". sql = sql + " where a.cust_num = b.cust_num". db_query(mysql,sql). mysql_res = db_use_result(mysql). repeat while db_fetch_into_array(mysql_res) <> -1: display mysql-row[1] mysql-row[2] mysql-row[3] mysql-row[4]. end. db_free_result(mysql_res). db_close(mysql).