I am trying to construct a mysql query that contains a table that is not related to the others. I am trying to create a check register using php and mysql. Unless there is a way to merge the deposits with the checks (By date) in the check register within a while loop from a different query.
Here is what the query looks like so far:
$mysqlrt = mysql_query("select * FROM checkregister,vendors,expensecodes,deposits WHERE checkregister.vendorid=vendors.vendorid AND checkregister.code=expensecodes.code ORDER by $sortby $order LIMIT $offset, $limit") or die ("The check register is not available.");
$row = mysql_fetch_array($mysqlrt);
I've tried a few things and can't get it to work correctly. As you can see the first 3 tables mentioned are related and make up the information needed to display a check in the check register - this works perfect. But now I want to merge in the deposits and have added the table deposits. The deposits table has absolutely no relation to the other tables, I want to select all the records from the deposits table but have the dates merged with the dates of the checks from the check register so it will display something like this:
check1 Jan 1, 2002
check2 Jan 2, 2002
deposit1 Jan 3, 2002
check3 Jan 4, 2002
deposit2 Jan 5, 2002
Very simplified but you get the idea. The dates need to be merged like this so I can print everything out in a while loop or something and have it work like an actual register.
Any help would be GREATLY appreciated.