Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL question

Status
Not open for further replies.

Cineno

Programmer
Jul 24, 2006
142
US
Hello, I have a question on how to make the below SQL code provide the proper looking result in my report. What I want the report to do is have the answers for each question organized in a way that for each answer the questions that have that same answer are listed togther. I'm very new to this, so I'm sorry if I don't explain it well. Here's an example:

What stores are in NY?
Syracuse
Albany
Atlanta

What stores are in Georgia?
Syracuse
Albany
Atlanta

After they are answered I want the report to look like this:

Stores in NY:
Syracuse
Albany

Stoes in Georgia:
Atlanta

See how Syracuse and Albany are grouped together because they are both in NY. The code I have now (not written by me) works but the answers are not grouped together. Here is the code in my report:

SELECT DISTINCTROW Confidentiality.JobID, Confidentiality.Amount AS [Use#], Responses_1.Response AS UseDesc, Responses.Response AS TypeLtr, Responses.JobDescr AS TypeDesc FROM Responses AS Responses_1 INNER JOIN (Responses INNER JOIN Confidentiality ON Responses.RespID = Confidentiality.RespID) ON Responses_1.RespID = Confidentiality.Amount;

The Confidentiality table holds the user's answers and has JobID as a key. RespID is like the cities up above. Amount is like the states above.

The Responses table stores all questions and possible answers and has RespID as a key. Response holds the values like states above. JobDescr holds the values like cities above.

Can anyone help me change this code to organize the results the way I want them? Thanks for any help!!
 
Use 'sorting and grouping' in the report and group by 'Amount'. Use group headers.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top