L
Leslie Isaacs
Hello all
I have a table [staffs] with key field 'name' (I know - very bad - but I
inherited this and the application works!), and a table [stafpay] with
linked field 'name'. Each [staffs].name value is in [stafpay] many times.
The following query returns all the expected records:
SELECT staffs.practice, staffs.ID
FROM staffs LEFT JOIN stafpay ON staffs.name = stafpay.name
GROUP BY staffs.practice, staffs.ID
HAVING (((staffs.practice)=[Forms]![frm x main]![prac name]));
This return every record from [staffs] with [staffs].practice=[Forms]![frm x
main]![prac name] - as expected.
BUT when I add a field from [stafpay] some records are omitted from the
query results.
e.g.
SELECT staffs.practice, staffs.ID
FROM staffs LEFT JOIN stafpay ON staffs.name = stafpay.name
WHERE (((stafpay.[month name])="November 2008"))
GROUP BY staffs.practice, staffs.ID
HAVING (((staffs.practice)=[Forms]![frm x main]![prac name]));
.... omits those records from [staffs] where there is no coresponding record
in [stafpay] with a 'month name' value of "November 2008". I would have
expected the LEFT JOIN in the query to mean that these records should have
been returned.
Hope someone can help - this is driving me nuts!
Many thanks
Les
I have a table [staffs] with key field 'name' (I know - very bad - but I
inherited this and the application works!), and a table [stafpay] with
linked field 'name'. Each [staffs].name value is in [stafpay] many times.
The following query returns all the expected records:
SELECT staffs.practice, staffs.ID
FROM staffs LEFT JOIN stafpay ON staffs.name = stafpay.name
GROUP BY staffs.practice, staffs.ID
HAVING (((staffs.practice)=[Forms]![frm x main]![prac name]));
This return every record from [staffs] with [staffs].practice=[Forms]![frm x
main]![prac name] - as expected.
BUT when I add a field from [stafpay] some records are omitted from the
query results.
e.g.
SELECT staffs.practice, staffs.ID
FROM staffs LEFT JOIN stafpay ON staffs.name = stafpay.name
WHERE (((stafpay.[month name])="November 2008"))
GROUP BY staffs.practice, staffs.ID
HAVING (((staffs.practice)=[Forms]![frm x main]![prac name]));
.... omits those records from [staffs] where there is no coresponding record
in [stafpay] with a 'month name' value of "November 2008". I would have
expected the LEFT JOIN in the query to mean that these records should have
been returned.
Hope someone can help - this is driving me nuts!
Many thanks
Les