I need to get aggregate data from multiple tables without excluding null values. When I pull the tables into crystal reports, it eliminates the results that have null values.
Example:
Table A contains a unique MemberID (which I need to group by) and a field for linking the tables (named ROWNO).
Table Demand
contains data I need included in a group (named D_BALANCE).
Table Loan
also contains data I need included in a group (named L_BALANCE), but does not always exist.
The tables link using a ROWNO
field on table A, rowno_custdmd_cust
on table Demand, and rowno_custloan_cust
on table Loan.
If the table has been generated for the MemberID then the rowno_custloan_cust will have a value, if the table has not been generated then the value would be NULL.
When I use Crystal Reports to try and pull all MemberID's and get all records of the BALANCE fields from both Table Demand and Table Loan, it eliminates any MemberID (filters out all records) that have a NULL value for rowno_custloan_cust.
I started investigating how to do this in SQL instead of Crystal Reports thinking that I may be able to better control the results, but also stop the results from being removed when they do not contain data in Table Loan.
Here is the code I am inquiring about changing. This is from the SQL import that sends the data to our database.
GO
/****** Object: Table [dbo].[loan] Script Date: 15May2022 11:24:25 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[loan](
[rowno] [int] NOT NULL,
[balance] [money] NOT NULL,
[rowno_custloan_cust] [int] NOT NULL,
CONSTRAINT [rowno_loan] PRIMARY KEY NONCLUSTERED
(
[rowno] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
What changes I would need to make or where I should start looking so that I may pull all members from Table A (cust) with any available data from the other two tables (loan and dmd) without it filtering out anyone who does not have a loan form attached? Would it be easiest to just get the data from the balance fields, link them by their key, create a new database with the info and pull from there?