capture non existing data

Hemant Karnik 121 Reputation points
2022-01-24T13:32:37.803+00:00

hi
I have a table name limit_master and we are string only one product in this table
currently i am having 50 branches and we are maintaining limits of each branch differently
Secondly we have data upto '31-mar-2010' in this table

However I want to generate report up to getdate() in below format

lbrcode         effdate        limit_amt

how can we do it ?
please help

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,808 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,558 questions
{count} votes

8 answers

Sort by: Most helpful
  1. Hemant Karnik 121 Reputation points
    2022-01-25T06:50:37.027+00:00

    here is a sample data
    LBrCode PrdCd EffDate Limit DbtrAddMk DbtrAddMb DbtrAddMs DbtrAddMd DbtrAddMt DbtrAddCk DbtrAddCb DbtrAddCs DbtrAddCd DbtrAddCt DbtrLupdMk DbtrLupdMb DbtrLupdMs DbtrLupdMd DbtrLupdMt DbtrLupdCk DbtrLupdCb DbtrLupdCs DbtrLupdCd DbtrLupdCt DbtrTAuthDone DbtrRecStat DbtrAuthDone DbtrAuthNeeded DbtrUpdtChkId DbtrLHisTrnNo Remarks
    1 CASH 2010-08-01 00:00:00.000 30000000 999 1 3 2010-08-04 00:00:00.000 1899-12-30 18:06:07.000 0 0 0 1900-01-01 00:00:00.000 1899-12-30 00:00:00.000 0 0 0 1900-01-01 00:00:00.000 1899-12-30 00:00:00.000 0 0 0 1900-01-01 00:00:00.000 1899-12-30 00:00:00.000 0 0 0 1 1 0
    1 CASH 2011-04-01 00:00:00.000 30000000 999 5 15 2012-05-05 00:00:00.000 1900-01-01 11:09:19.000 18 999 10 2013-04-03 00:00:00.000 1900-01-01 12:50:50.000 0 0 0 1900-01-01 00:00:00.000 1900-01-01 00:00:00.000 0 0 0 1900-01-01 00:00:00.000 1900-01-01 00:00:00.000 1 0 1 0 2 7 CASH LIMIT
    1 CASH 2013-03-31 00:00:00.000 50000000 282 999 74 2013-04-03 00:00:00.000 1900-01-01 12:50:22.000 18 999 10 2013-04-03 00:00:00.000 1900-01-01 12:50:47.000 0 0 0 1900-01-01 00:00:00.000 1900-01-01 00:00:00.000 0 0 0 1900-01-01 00:00:00.000 1900-01-01 00:00:00.000 1 0 1 0 2 6

    0 comments No comments

  2. Hemant Karnik 121 Reputation points
    2022-01-25T07:10:42.647+00:00

    let me try again

    168201-sample-data.png


  3. Hemant Karnik 121 Reputation points
    2022-01-28T10:22:08.453+00:00
    with main as (
    select lbrcode,efdate,limit from limit_master
    )
    ,
    hrk as (
    select main.lbrcode,level effdate,limit  from dual
    connect by level<='30-jun-2021'-max(main.effdate)
    )
    select a.*,b.* from main a ,hrk b
    

    is this possible? sir please help

    0 comments No comments