Prepare Sum of Bill Amount Having two different status with fast performance

  • 1, Customer table [TBLMEMBER] 's structure

    CREATE TABLE [dbo].[TBLMEMBER](
    [TRANNO] [int] IDENTITY(1,1) NOT NULL,
    [PARENTID] [nvarchar](10) NULL,
    [ACID] [nvarchar](10) NULL,
    [MEMBERID] [nvarchar](10) NOT NULL,
    [MEMNAME] [nvarchar](70) NULL,
    [PRINTNAME] [nvarchar](50) NULL,
    [GENDER] [nchar](10) NULL,
    [ADDRESS] [varchar](30) NULL,
    [DOB] [varchar](20) NULL,
    [PROV] [int] NULL,
    [GROUP] [nchar](2) NULL,
    [USERID] [nvarchar](15) NULL,
    [DISTRICT] [int] NULL,
    [PWD] [nvarchar](100) NOT NULL,
    [MOBILE] [nchar](10) NULL,
    [PANNO] [varchar](20) NULL,
    [PATH] [nvarchar](max) NULL,
    [varchar](30) NULL,
    [CITIZENSHIP] [varchar](50) NULL,
    [STATUS] [char](2) NULL,
    [REFERRBY] [varchar](10) NULL,
    [REFERBY] [varchar](10) NULL,
    [DATEJOIN] [datetime] NULL,
    [DIPO] [varchar](5) NULL,
    [CTEAM] [nvarchar](max) NULL,
    [CSTATUS] [char](2) NULL,
    CONSTRAINT [PK_TBLMEMBER_1] PRIMARY KEY CLUSTERED
    (
    [MEMBERID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    2, I've created a table with following structure

    CREATE TABLE [dbo].[TBLMBUSINESS](
    [TRNDATE] [date] NOT NULL,
    [DATETIME] [datetime] NOT NULL,
    [VCHRNO] [nvarchar](10) NOT NULL,
    [BILAMT] [money] NOT NULL,
    [BVAMT] [money] NOT NULL,
    [DISCOUNT] [money] NULL,
    [AMOUNT] [money] NULL,
    [BILLCAT] [money] NULL,
    [MEMBERID] [nvarchar](15) NOT NULL,
    [STATUS] [char](2) NULL,
    ) ON [PRIMARY]

    3, i

    Attachments:
    You must be logged in to view attached files.
  • What is your question?


  • Want to acomplish all calculations in a few minutes.

     

  • techrajendra wrote:

    Want to acomplish all calculations in a few minutes.

    That's a requirement, not a question.

    Why don't you start by presenting what you have tried so far, along with your findings?


  • Photos of data are not data.  If it's not worth your time to provide actual data, it's not worth my time to scrape your photos for actual data.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply