nickison99
02-08-2006, 10:24 PM
Hi All,
I have two tables in my database, ps_accounts and ps_participants. The participants table has a field (account_id) relating it to the ps_accounts table. I need to do a query to pull the accounts, and their respective participants. This si the query I have:
SELECT
`ps_accounts`.`id`,
`ps_accounts`.`parent_a_first_name`,
`ps_accounts`.`parent_a_last_name`,
`ps_accounts`.`parent_b_first_name`,
`ps_accounts`.`parent_b_last_name`
FROM `ps_participants`
INNER JOIN `ps_accounts` ON (`ps_participants`.`account_id` = `ps_accounts`.`id`)
BUT some of the accounts do not have related participants in the ps_participants table yet, but I still need to show the accounts. With the inner join, it only returns the accounts where there are participants attached to it. It there a way, using one query, to return all the accounts, and show all participants, if applicable? I'm using mysql 4.1.
Thanks!
I have two tables in my database, ps_accounts and ps_participants. The participants table has a field (account_id) relating it to the ps_accounts table. I need to do a query to pull the accounts, and their respective participants. This si the query I have:
SELECT
`ps_accounts`.`id`,
`ps_accounts`.`parent_a_first_name`,
`ps_accounts`.`parent_a_last_name`,
`ps_accounts`.`parent_b_first_name`,
`ps_accounts`.`parent_b_last_name`
FROM `ps_participants`
INNER JOIN `ps_accounts` ON (`ps_participants`.`account_id` = `ps_accounts`.`id`)
BUT some of the accounts do not have related participants in the ps_participants table yet, but I still need to show the accounts. With the inner join, it only returns the accounts where there are participants attached to it. It there a way, using one query, to return all the accounts, and show all participants, if applicable? I'm using mysql 4.1.
Thanks!