D
Doctor
How do I put multiple values into the value portion of a crosstab query? Or
perhaps a more appropriate question would be how do I represent the data in a
crosstab query from tables based on a many to many relationship?
My tables of importance to this question are:
tblTraining: TrainingID, TrainingName, etc.
tblGenre: GenreID, Genre
tblGenreLink: TrainingID, GenreID
I am trying to put together a crosstab query that shows me a session time
slot in the row header, a room number in the column header and a list of
genres represented by the underlying trainings being taught in those time
slots. I have already built a query that shows me the training name in this
way (SQL below). But now I want to see the many genres for each Training in
the Values portion of each row.
Crosstab for Training name:
TRANSFORM First(qryLLCScheduleMatrix.[InfoShort]) AS FirstOfInfoShort
SELECT qryLLCScheduleMatrix.LLID, qryLLCScheduleMatrix.[LLCWorkshopNum],
Count(qryLLCScheduleMatrix.Speaker) AS Sessions
FROM qryLLCScheduleMatrix
GROUP BY qryLLCScheduleMatrix.LLID,
qryLLCScheduleMatrix.LLCWorkshopNumSequence,
qryLLCScheduleMatrix.[LLCWorkshopNum]
ORDER BY qryLLCScheduleMatrix.LLCWorkshopNumSequence
PIVOT qryLLCScheduleMatrix.[Room];
Best Attempt for what I want:
TRANSFORM First([qryLLCSessionInfo].[LLCWorkshopNum] & " (" & [InfoShort] &
")") AS Expr1
SELECT tblLLCSessionGenre.LLCSessionGenre
FROM tblLLCSessionGenre INNER JOIN ((qryLLCSessionInfo INNER JOIN
qryLLCScheduleMatrix ON qryLLCSessionInfo.LLCSessionID =
qryLLCScheduleMatrix.LLCSessionID) INNER JOIN tblLLCSessionGenreLink ON
qryLLCSessionInfo.TrainingID = tblLLCSessionGenreLink.TrainingID) ON
tblLLCSessionGenre.LLCSessionGenreID =
tblLLCSessionGenreLink.LLCSessionGenreID
GROUP BY qryLLCScheduleMatrix.LLID,
qryLLCScheduleMatrix.LLCWorkshopNumSequence,
tblLLCSessionGenre.LLCSessionGenre
ORDER BY qryLLCScheduleMatrix.LLID,
qryLLCScheduleMatrix.LLCWorkshopNumSequence
PIVOT qryLLCScheduleMatrix.Room;
This doesn't work becuase it only shows the first training name in each
category.
Thanks in advance for any help on such a loaded question.
perhaps a more appropriate question would be how do I represent the data in a
crosstab query from tables based on a many to many relationship?
My tables of importance to this question are:
tblTraining: TrainingID, TrainingName, etc.
tblGenre: GenreID, Genre
tblGenreLink: TrainingID, GenreID
I am trying to put together a crosstab query that shows me a session time
slot in the row header, a room number in the column header and a list of
genres represented by the underlying trainings being taught in those time
slots. I have already built a query that shows me the training name in this
way (SQL below). But now I want to see the many genres for each Training in
the Values portion of each row.
Crosstab for Training name:
TRANSFORM First(qryLLCScheduleMatrix.[InfoShort]) AS FirstOfInfoShort
SELECT qryLLCScheduleMatrix.LLID, qryLLCScheduleMatrix.[LLCWorkshopNum],
Count(qryLLCScheduleMatrix.Speaker) AS Sessions
FROM qryLLCScheduleMatrix
GROUP BY qryLLCScheduleMatrix.LLID,
qryLLCScheduleMatrix.LLCWorkshopNumSequence,
qryLLCScheduleMatrix.[LLCWorkshopNum]
ORDER BY qryLLCScheduleMatrix.LLCWorkshopNumSequence
PIVOT qryLLCScheduleMatrix.[Room];
Best Attempt for what I want:
TRANSFORM First([qryLLCSessionInfo].[LLCWorkshopNum] & " (" & [InfoShort] &
")") AS Expr1
SELECT tblLLCSessionGenre.LLCSessionGenre
FROM tblLLCSessionGenre INNER JOIN ((qryLLCSessionInfo INNER JOIN
qryLLCScheduleMatrix ON qryLLCSessionInfo.LLCSessionID =
qryLLCScheduleMatrix.LLCSessionID) INNER JOIN tblLLCSessionGenreLink ON
qryLLCSessionInfo.TrainingID = tblLLCSessionGenreLink.TrainingID) ON
tblLLCSessionGenre.LLCSessionGenreID =
tblLLCSessionGenreLink.LLCSessionGenreID
GROUP BY qryLLCScheduleMatrix.LLID,
qryLLCScheduleMatrix.LLCWorkshopNumSequence,
tblLLCSessionGenre.LLCSessionGenre
ORDER BY qryLLCScheduleMatrix.LLID,
qryLLCScheduleMatrix.LLCWorkshopNumSequence
PIVOT qryLLCScheduleMatrix.Room;
This doesn't work becuase it only shows the first training name in each
category.
Thanks in advance for any help on such a loaded question.