Click here to Skip to main content
12,510,818 members (52,498 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# Access
I tried several but i did not get the correct output

Select * from Tb_SCh_TIme_Table;
Output shows as follows;

Date Session Course FAculty_Code

1/14/2013 3 AFF PN
1/21/2013 2 AFF NR
1/21/2013 1 AFF GS
1/24/2013 4 AFF VB
1/14/2013 4 AFF CM
1/16/2013 3 AFF NR
1/21/2013 2 AFF GS

I tried the below query as follows;

TRANSFORM First(Tb_SCh_TIme_Table.Faculty_Code) AS a
SELECT 
Tb_SCh_TIme_Table.Course
FROM 
Tb_SCh_TIme_Table
GROUP BY 
Tb_SCh_TIme_Table.Course
PIVOT 
Tb_SCh_TIme_Table.Session

Output as follows;

Course 1 2 3 4
AFF GS NR NR VB
ARPA VB VB GS
CTF NR PN
ECDIS VB PN PN
ERSM CM GS RK
LGTF VB NR
MFA PN NR PN
PH2 PN RK NR
REO NR GS NR VB
TASCO GS CM CM GS
TFC CM GS GS

From the first query select * from Tb_SCh_TIme_Table;the Second ouput is not matching.
from the query what is the mistake. help me.

if AFF course is taken by same session and differnet Facultycode means output is not correctly showing.it is not matching with select * from Tb_SCh_TIme_Table;
what is the mistake in above query help me. please
Posted 24-Jan-13 19:38pm
Updated 25-Jan-13 0:34am
CHill60158.1K
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Since there are multiple Faculties for same session for a single course, you have to include Date in the query. Because the sessions belongs to different dates.

Use the following query.

TRANSFORM First(Tb_SCh_TIme_Table.Faculty_Code) AS a
SELECT Tb_SCh_TIme_Table.Date, Tb_SCh_TIme_Table.Course
FROM Tb_SCh_TIme_Table
GROUP BY Tb_SCh_TIme_Table.Date, Tb_SCh_TIme_Table.Course
PIVOT Tb_SCh_TIme_Table.Session;
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100