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 6775801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:57:01+00:00 2026-05-26T15:57:01+00:00

I given task for stock entries management where stock can be either three types(1-supplier,

  • 0

I given task for stock entries management where stock can be either three types(1-supplier, 2-Companies, 3-customer),

i have 2 tables(A and B) to maintain it,A use to track current status, and B used as history table to track the movement

initial will be stock type 1, so inserted into A, if company buy it, table B will inserted from table A for that record and will updated stock type in table A,

so to get closing stock balance till a particular date i can read from table A,

but having difficulty to get opening stock balance where i have to read from table B

can anyone help, sorry if my question confusing

structure of the table:

TABLE A

NUM_REF CHAR (6) NOT NULL,
BRANCH CHAR (5) NOT NULL,
STOCK_TYPE  CHAR (3) NOT NULL,
INSERT_DATE TIMESTAMP NOT NULL

TABLE B

NUM_RIF CHAR (6) NOT NULL,
BRANCH CHAR (5) NOT NULL,
STOCK_TYPE  CHAR (3) NOT NULL,
INSERT_DATE CHAR(2) NOT NULL,  
UPDATE_DATE TIMESTAMP NOT NULL

record from table A

000295 10400 03 10/24/2011 5:11:12 PM  10/11/2011 12:27:21 PM
000338 10400 02 10/14/2011 7:51:56 PM  10/13/2011 12:54:28 PM
000399 10400 03 10/24/2011 6:25:53 PM  10/21/2011 6:13:20 PM 
000400 10400 02 10/14/2011 8:06:21 PM  10/14/2011 4:21:37 PM 
000410 10400 03 10/18/2011 5:17:36 PM  10/18/2011 5:17:36 PM 
000416 10400 03 10/18/2011 5:27:19 PM  10/18/2011 5:27:19 PM 
000420 10400 03 10/25/2011 6:18:35 PM  10/17/2011 3:01:49 PM 
000423 10400 03 10/25/2011 6:18:35 PM  10/17/2011 4:10:00 PM 
000450 10400 03 10/19/2011 4:45:38 PM  10/18/2011 2:30:40 PM 

record from table B

000284 10400 01 10/10/2011 5:49:15 PM
000288 10400 01 10/11/2011 12:22:50 P
000289 10400 01 10/11/2011 12:23:35 P
000295 10400 01 10/11/2011 12:27:21 P
000295 10400 03 10/13/2011 2:47:33 PM
000295 10400 03 10/13/2011 2:58:31 PM
000295 10400 03 10/13/2011 3:22:19 PM
000295 10400 03 10/13/2011 4:34:07 PM
000295 10400 03 10/13/2011 4:41:08 PM
000295 10400 03 10/13/2011 4:41:40 PM
000295 10400 03 10/13/2011 4:45:05 PM
000295 10400 03 10/13/2011 4:46:36 PM
000295 10400 03 10/13/2011 4:56:03 PM
000295 10400 03 10/13/2011 4:58:47 PM
000295 10400 03 10/14/2011 11:15:47 A
000295 10400 03 10/14/2011 5:45:33 PM
000296 10400 01 10/11/2011 12:27:21 P
000328 10400 01 10/13/2011 12:20:49 P
000328 10400 03 10/14/2011 12:31:07 P
000328 10400 03 10/17/2011 3:41:45 PM
000328 10400 03 10/18/2011 12:14:21 P
000328 10400 02 10/20/2011 4:41:39 PM
000331 10400 01 10/13/2011 12:25:02 P
000331 10400 03 10/14/2011 3:03:31 PM
000331 10400 03 10/17/2011 3:54:02 PM
000333 10400 01 10/13/2011 12:33:19 P
000333 10400 03 10/14/2011 4:01:59 PM
000333 10400 03 10/18/2011 11:06:18 A
000337 10400 01 10/13/2011 12:52:23 P
000338 10400 01 10/13/2011 12:54:28 P
000369 10400 01 10/14/2011 12:33:43 P
000369 10400 02 10/14/2011 8:05:03 PM
000369 10400 03 10/17/2011 2:42:19 PM
000369 10400 03 10/18/2011 2:24:56 PM
000399 10400 01 10/21/2011 6:13:20 PM
000400 10400 01 10/14/2011 4:21:37 PM
000420 10400 01 10/17/2011 3:01:49 PM
000420 10400 03 10/17/2011 3:13:07 PM
000420 10400 03 10/25/2011 6:16:43 PM
000423 10400 01 10/17/2011 4:10:00 PM
000423 10400 03 10/25/2011 6:16:43 PM
000424 10400 01 10/17/2011 4:22:04 PM
000424 10400 03 10/25/2011 6:42:06 PM
000425 10400 01 10/17/2011 4:24:41 PM
000425 10400 03 10/25/2011 6:42:06 PM
  • 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-05-26T15:57:01+00:00Added an answer on May 26, 2026 at 3:57 pm
    SELECT StockId, Max(Date)
    FROM (SELECT StockId, max(Date)
          FROM TableA
          GROUP BY StockId
          UNION ALL
          SELECT StockId, max(Date)
          FROM TableB
          GROUP BY StockId) a
    GROUP BY StockId
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was once given this task to do in an RDBMS: Given tables customer,
I have database tables that look like this: A Task can be mapped to
recently I was given the task to discover a C# solution I have never
I have been given the task of adding functionality to an existing IIS 6.0
i have a task to compress a stock market data somehow...the data is in
I was given the task of improving the performance of a stock market charting
I have been given the task to fix an Embedded Operating System which is
Example Given a number of different task types that need to be completed over
Estimating how long any given task will take seems to be one of the
Simple task: given that an article has many comments, be able to display in

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.