Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8282823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:30:49+00:00 2026-06-08T10:30:49+00:00

I have an sql query in which I have table named attan for the

  • 0

I have an sql query in which I have table named attan for the attendance and column named
S_TIME in which I stored in time and out time with a setting a flag of in with I and for O

Now I am trying to get in time as well as out time using the flag. I have written a query but result from this query are making some wrong sense.

Here is my query

SELECT X.AC_NO, X.IN_TIME, Y.OUT_TIME, X.S_DTE, X.CHK_IN, Y.CHK_OUT
  FROM (SELECT A.AC_NO, A.S_TIME IN_TIME, A.AC_CHECKTYPE CHK_IN, A.S_DTE
          FROM ATTN A
         WHERE A.AC_CHECKTYPE = 'I' AND A.S_DTE = :P_DTE) X,
       (SELECT B.AC_NO, B.S_TIME OUT_TIME, B.AC_CHECKTYPE CHK_OUT
          FROM ATTN B
         WHERE B.AC_CHECKTYPE = 'O' AND B.S_DTE = :P_DTE) Y
 WHERE X.AC_NO = Y.AC_NO(+)

Through this query I always get the number of records of the employees who are in and only get 2 number of reocrds with out time.

Whereas in table there are 234 number of emps who are in and 256 are out but results don’t match the data.

Please any one help me if any problem in my query.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:30:51+00:00Added an answer on June 8, 2026 at 10:30 am

    SUGGESTION:

    1. Run the subselects and see if you’re getting all the rows you expect, with and without the “A.S_DTE = :P_DTE” date filter:

      SELECT A.AC_NO, A.S_TIME IN_TIME, A.AC_CHECKTYPE CHK_IN, A.S_DTE
      FROM ATTN A
      WHERE A.AC_CHECKTYPE = 'I' AND A.S_DTE = :P_DTE

    2. My first guess is that maybe you have a datetime, and unless the hours/minutes/seconds match exactly, you won’t get the row. You can use to_char() to have just the “date” portion in your “from”:

      http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:204714700346328550

    3. In any case, seeing what rows you do (and don’t) get in the subqueries should show you what’s wrong with the complete query.

    Please post back what you find!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a T-SQL query as below which queries a table holding the search
Right now I have this SQL query which is valid but always times out:
I have a server table which has a column named 'SN' in mysql, when
What sql query would you write to get the table names which have a
I have daily scheduled task that queries a table which includes column named AttemptDate
I have a sql query which looks like this - NSString *createSQL = @SELECT
using php, i have a sql query which works fine, dateentry only has the
I have a SQL Server query which runs just fine -- until I add
In my Java code I have embedded a SQL query which fetches data from
I have following somewhat complex sql query which has horrible performance, 'certainly' due to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.