B
Blackberry
Hi All
Wondered if you could help. I'm using SQL queries in Access 2003 and I
can't fathom the below.
My table data is defined as follows:
TERMID SHORTNAME YEAR
0 Sep 2007
0 Sep 2008
1 Jan 2008
2 Apr 2008
3 Jul 2008
1 Jan 2009
2 Apr 2009
3 Jul 2009
The TERMID relates to the shortname in that 0 = Sep, 1 = Jan, 2 = Apr and 3
= Jul.
My current query is as follows:
select distinct l.TERMID, t.SHORTNAME, l.[YEAR] from LEVELS l, TERMS t where
l.TERMID=t.TERMID ORDER BY 3,1
This is producing the above results, but I need the results to come out as
follows:
TERMID SHORTNAME YEAR
0 Sep 2007
1 Jan 2008
2 Apr 2008
3 Jul 2008
0 Sep 2008
1 Jan 2009
2 Apr 2009
3 Jul 2009
Basically the year sorts as is, but the term id / shortname needs to sort in
the calendar format of Jan, Apr, Jul & Sep for the respective year (which is
1,2,3,0 in my termids). Do you know of any way I can do this?
Thanks
Wondered if you could help. I'm using SQL queries in Access 2003 and I
can't fathom the below.
My table data is defined as follows:
TERMID SHORTNAME YEAR
0 Sep 2007
0 Sep 2008
1 Jan 2008
2 Apr 2008
3 Jul 2008
1 Jan 2009
2 Apr 2009
3 Jul 2009
The TERMID relates to the shortname in that 0 = Sep, 1 = Jan, 2 = Apr and 3
= Jul.
My current query is as follows:
select distinct l.TERMID, t.SHORTNAME, l.[YEAR] from LEVELS l, TERMS t where
l.TERMID=t.TERMID ORDER BY 3,1
This is producing the above results, but I need the results to come out as
follows:
TERMID SHORTNAME YEAR
0 Sep 2007
1 Jan 2008
2 Apr 2008
3 Jul 2008
0 Sep 2008
1 Jan 2009
2 Apr 2009
3 Jul 2009
Basically the year sorts as is, but the term id / shortname needs to sort in
the calendar format of Jan, Apr, Jul & Sep for the respective year (which is
1,2,3,0 in my termids). Do you know of any way I can do this?
Thanks