Help with dates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • baruch
    New Member
    • Mar 2008
    • 2

    #1

    Help with dates

    Hello fellas,

    Am really new at asp, but am learning as fast as I can, but now am with a challenge and don't know how to do this....

    I need to build an asp-based report, there is a databace SQL based, where all the door using is registered with the credential, who has an employee name.

    The challenge is that some people uses the main door several times at day, then all those movements are logged into the SQL DB, so HHRR only needs to know the first time that you used (Day and time of your assistance) and the last time (when you leaved the building)

    I know how to connect to the DB, and get the info, but i have no ideas of how to obtain that info, for each day and only show:

    Employee Name: XXXXXX

    Monday 11/03/2008 8:30 am 11/03/2008 6:30 pm
    Thursday 12/03/2008 8:00 am ETC.....


    About the format I can do it by my self, but how to obtain only the first and the last date???
  • jeffstl
    Recognized Expert Contributor
    • Feb 2008
    • 432

    #2
    Originally posted by baruch
    Hello fellas,

    Am really new at asp, but am learning as fast as I can, but now am with a challenge and don't know how to do this....

    I need to build an asp-based report, there is a databace SQL based, where all the door using is registered with the credential, who has an employee name.

    The challenge is that some people uses the main door several times at day, then all those movements are logged into the SQL DB, so HHRR only needs to know the first time that you used (Day and time of your assistance) and the last time (when you leaved the building)

    I know how to connect to the DB, and get the info, but i have no ideas of how to obtain that info, for each day and only show:

    Employee Name: XXXXXX

    Monday 11/03/2008 8:30 am 11/03/2008 6:30 pm
    Thursday 12/03/2008 8:00 am ETC.....


    About the format I can do it by my self, but how to obtain only the first and the last date???
    Before I give this a shot can I ask how familiar are you with SQL? Or atleast the program you use to build querys into the database?

    Im not exactly sure if this answers your question because I'm not familiar with your specific database. However, there is a way to get the earliest record and latest record of the day IF you are using autonumbers or some kind of ascending number system for each unique key of a time stamp record.

    If you ARE doing that then there is SQL that you can use to get the MAX and MIN value of that key for the record, (in other words the actual order the records were written in) and those will be your 2 records you need for the 2 time stamp values.
    'This would get the last stamp of the day
    SELECT MAX(column) FROM table

    You might even be able to do this strictly with your date\time columns though again, Im not sure how they are formatted, if they are seperate columns, etc.

    Your best bet would be the primary key if possible.

    Comment

    • baruch
      New Member
      • Mar 2008
      • 2

      #3
      Thank you for posting...


      This is the format of the dates

      dd/mm/aaaa hh:mm AM/PM

      and is helpfull with the actual reports (mean while I understand the DB), and if there is some organization or specific secuencial number or ID each day..

      THANK YOU SO MUCH :D

      As a teacher told me at school "For greatest problems, easiest solutions" :D

      Comment

      Working...