Report Query

database

Registered User.
Local time
Today, 12:34
Joined
Jun 3, 2004
Messages
80
Greetings Everyone....

I am making a report where I need to have first name, last name and the topics assigned to a person.

I have two tables
1) info with fields name_id ,first name and last name
2) Topics with fields Name_id,Topic_index, Topic_id ,MainTopic and SubTopic

Each person can have more than one topic.

I need to make a query for the report so that I will have info about the perosn.

I have made a query like this:

SELECT DISTINCT tblInfo.FirstName, tblInfo.LastName, Topics.Topic_id, Topics.MainTopic, Topics.Subtopic
FROM tblInfo INNER JOIN Topics ON tblInfo.Name_id = Topics.Name_id;

With this query, whenever there are more than 1 topic assigned to one person, his name is displayed that many number of times, which is what I dont want.

Can anyone help me with this?
I want the information Firstname and last name displayed only once and then the number of topics.

Please help !!!!!!
 
If youo use GROUPING in your report it will do that for you.
 
FoFa said:
If youo use GROUPING in your report it will do that for you.

I tried running a query like this


SELECT DISTINCT tblInfo.FirstName, tblInfo.LastName, Topics.Topic_id, Topics.MainTopic, Topics.Subtopic
FROM tblInfo INNER JOIN Topics ON tblInfo.Name_id = Topics.Name_id
GROUP BY tblInfo.FisrtName;

and it gives an error
"You tried to execute a query that does not include the specified expression 'LastName' as a part of an aggregate function."

And if I include all tblInfo.FirstName, tblInfo.LastName, Topics.Topic_id, Topics.MainTopic, Topics.Subtopic then it gives me the same result that i get before doing the grouping !

Any suggestions?

Thanks for you help !
 

Users who are viewing this thread

Back
Top Bottom