If this correct use of Select

F

forest8

Hi there

I want to use the following statement in the RowSource for a report but am
unsure of whether it's correct:

SELECT *, *
FROM T_Participants RIGHT JOIN T_General ON T_Participants.[Student_ID] =
T_General[StudentID_FK];

Does this look correct to anyone?

Thank you in advance for your help.
 
J

John W. Vinson

Hi there

I want to use the following statement in the RowSource for a report but am
unsure of whether it's correct:

SELECT *, *
FROM T_Participants RIGHT JOIN T_General ON T_Participants.[Student_ID] =
T_General[StudentID_FK];

Does this look correct to anyone?

Not really. The SELECT * syntax means to select all fields (from all tables);
so by using the asterisk twice you're saying SELECT each field twice. I expect
Access will assign an alias fieldname to one of the duplicates. The RIGHT JOIN
will cause all records in T_General to be included, whether or not they have a
match in T_Participants; if they do have a match you'll get all the field
values in T_Participants, otherwise those fields will be in the report's
recordsource with NULL values.

Could you explain what fields are in the two tables, and what you intend this
query to accomplish?
 
F

forest8

I was planning on using the select in the rowsource of a report.



John W. Vinson said:
Hi there

I want to use the following statement in the RowSource for a report but am
unsure of whether it's correct:

SELECT *, *
FROM T_Participants RIGHT JOIN T_General ON T_Participants.[Student_ID] =
T_General[StudentID_FK];

Does this look correct to anyone?

Not really. The SELECT * syntax means to select all fields (from all tables);
so by using the asterisk twice you're saying SELECT each field twice. I expect
Access will assign an alias fieldname to one of the duplicates. The RIGHT JOIN
will cause all records in T_General to be included, whether or not they have a
match in T_Participants; if they do have a match you'll get all the field
values in T_Participants, otherwise those fields will be in the report's
recordsource with NULL values.

Could you explain what fields are in the two tables, and what you intend this
query to accomplish?
 
J

John W. Vinson

Fine; what's in the table, and what do you want to see in the report?

Remember *you* can see your database. I cannot.
I was planning on using the select in the rowsource of a report.



John W. Vinson said:
Hi there

I want to use the following statement in the RowSource for a report but am
unsure of whether it's correct:

SELECT *, *
FROM T_Participants RIGHT JOIN T_General ON T_Participants.[Student_ID] =
T_General[StudentID_FK];

Does this look correct to anyone?

Not really. The SELECT * syntax means to select all fields (from all tables);
so by using the asterisk twice you're saying SELECT each field twice. I expect
Access will assign an alias fieldname to one of the duplicates. The RIGHT JOIN
will cause all records in T_General to be included, whether or not they have a
match in T_Participants; if they do have a match you'll get all the field
values in T_Participants, otherwise those fields will be in the report's
recordsource with NULL values.

Could you explain what fields are in the two tables, and what you intend this
query to accomplish?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top