how can select

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • idsanjeev
    New Member
    • Oct 2007
    • 241

    how can select

    i have need help in sql Select stetements.
    i am very confuse for a quary
    my need to select first entry and last out datewise of all memeber that is stored in table and member is enter and out more than one time a day but i have to display perday first entery and last out between selected months
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Originally posted by idsanjeev
    i have need help in sql Select stetements.
    i am very confuse for a quary
    my need to select first entry and last out datewise of all memeber that is stored in table and member is enter and out more than one time a day but i have to display perday first entery and last out between selected months
    I assume you are looking for something like this:

    [code=oracle]

    SELECT x.member_name FROM table x WHERE (x.date_logged_ in,x.logged_out ) = (SELECT MIN(logging_tim e),MAX(logging_ time) FROM table WHERE member_name = x.member_name)

    [/code]

    The login and logout details are refering to same column in the table?

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      Are you working on something like an attendance register ?

      Comment

      • idsanjeev
        New Member
        • Oct 2007
        • 241

        #4
        Hi debasisdas
        Yes you are right i am woking on attance system.
        i am using two table thats is let me try to define
        my table name is acs_data and its field is empno,opdate,op time,ioflg,card no,seqno
        empno is no of member, opdate is date optime is time ioflg is i for in and o for out card no is both side of door that is encoded i or o and othe tbale is emptable where empno, empname,
        designame and i have to display all employee records/perday with maximum out and minimum in time
        thanks

        Comment

        • idsanjeev
          New Member
          • Oct 2007
          • 241

          #5
          Thanks
          by using this i am getting the result thats are required
          [code=vb]
          Set RS3=CON.Execute (" SELECT a.EMPNO,a.seqno ,TO_CHAR(a.OPDA TE,'DD-Mon-YYYY') OPDATE , b.dscr,a.optime ,a.ioflg,a.PNCH _FLG FROM ACS_DATA a, M_CARD b WHERE a.cardno = b.readerno AND EMPNO IN (SELECT EMPNO FROM M_FIX_EMPLOYEE@ alf2 WHERE opdate>= '15-jan-2008' AND opdate <='25-jan-2008' AND DEPT_CD = 124) AND ( seqno = 1 OR seqno = (SELECT MAX(seqno) FROM ACS_DATA WHERE empno = a.empno AND opdate = a.opdate) ) ORDER BY empno")[/CODE]

          i have need another type of help for read date of previous months if current months is feb than select jan like 1-jan-2008 if case is not jan always select day from 1 months prev year current
          thanks
          Last edited by debasisdas; Feb 13 '08, 04:57 AM. Reason: added code=vb tags

          Comment

          • idsanjeev
            New Member
            • Oct 2007
            • 241

            #6
            hello
            Thanks i got it working thats my need
            thanks again
            for nice support

            Comment

            Working...