Need Help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table that has a Date Field. What I am trying to do is to lable
each day as Day 1, Day 2, Day 3 etc. for each employee. The employee will
only appear in the table when a transaction has occured. The goal is to view
as:

Employee Date Day
Mike M 2/22/06 Day 1
Mike M 2/23/06 Day 2
Mike M 2/24/06 Day 3
John Doe 2/25/06 Day 1

Any help will be greatly appreciated. Please let me know if you need
additional info.
 
Michael said:
I have a table that has a Date Field. What I am trying to do is to lable
each day as Day 1, Day 2, Day 3 etc. for each employee. The employee will
only appear in the table when a transaction has occured. The goal is to view
as:

Employee Date Day
Mike M 2/22/06 Day 1
Mike M 2/23/06 Day 2
Mike M 2/24/06 Day 3
John Doe 2/25/06 Day 1

Any help will be greatly appreciated. Please let me know if you need
additional info.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I believe this might work:

SELECT Employee, [Date],
(SELECT Count(*) FROM table_name WHERE Employee=T.Employee
AND [Date] <= T.[Date]) As [Day]
FROM table_name As T
WHERE <criteria>

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/4sZIechKqOuFEgEQKfEwCdGI+T14Ju3Pe9oWLyY9Wni4ws8oMAoKM0
rXE+bo5tvlf1lnPZza28KNyp
=XB3R
-----END PGP SIGNATURE-----
 
Worked like a charm.... Thank you Dr. Foster!!

MGFoster said:
Michael said:
I have a table that has a Date Field. What I am trying to do is to lable
each day as Day 1, Day 2, Day 3 etc. for each employee. The employee will
only appear in the table when a transaction has occured. The goal is to view
as:

Employee Date Day
Mike M 2/22/06 Day 1
Mike M 2/23/06 Day 2
Mike M 2/24/06 Day 3
John Doe 2/25/06 Day 1

Any help will be greatly appreciated. Please let me know if you need
additional info.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I believe this might work:

SELECT Employee, [Date],
(SELECT Count(*) FROM table_name WHERE Employee=T.Employee
AND [Date] <= T.[Date]) As [Day]
FROM table_name As T
WHERE <criteria>

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/4sZIechKqOuFEgEQKfEwCdGI+T14Ju3Pe9oWLyY9Wni4ws8oMAoKM0
rXE+bo5tvlf1lnPZza28KNyp
=XB3R
-----END PGP SIGNATURE-----
 
Back
Top