well, that's nice query you have there.
Unfortunately, without knowing your db structure, I cannot help you much, except to tell you you should use OUTER JOIN to do that.
Basically, an INNER JOIN means that if all the tables don't have matching datas, nothing will show up.
But on an OUTER JOIN, the result will display a part of them, even if there are no datas in a second table.
Look at this.
I have a table "user" and a table "loginLog"
Code:
create table user(
uid numeric not null,
primary key (uid)
);
create table loginLog(
uid numeric not null,
loginDt date,
success boolean,
primary key (uid)
);
Now, I'll mach all the user who have registered and logged in.
Code:
SELECT *
FROM user u, loginLog l
WHERE u.uid=l.uid
This is valid, but as it's use inner joins, if a member signed up and didn't lgged in, he won't show in the result.
Let's rewrite it with an outer join:
Code:
SELECT *
FROM user u LEFT OUTER JOIN loginLog l ON u.uid=l.uid
And there, every users in the table "user" will be displayed, even if there are no record in the table loginLog.
Hope that's help to build your qurey.
NOTE:
Doing an
Code:
SELECT *
FROM user u, loginLog l
WHERE u.uid=l.uid
is the same as
Code:
SELECT *
FROM user u
INNER JOIN loginLog l
WHERE u.uid=l.uid