I have a db made up of sample data, tblRentals holds the transactions for rental units.
RentalIDPKStorageShedIDFKCustomerIDFKBeginningDateFKEndingDatePaymentDateRentalRateIDFKPaymentMadePaymentBalanceDuePaymentTypeIDFKCheckNumberCreditCardNameIDFKCreditCardNumberMoneyOrderNumberLateCharges
If I build a query and run it with all the FK included I lose 3/4 (returns 55 of 219)of the records. I narrowed it down to the CreditCardName table. When I add this table records disappear.
without CreditCardName table.
Attachment 2038
with CreditCardName table.
Attachment 2037
Code:
SELECT tblRentals.RentalID, tblStorageUnits.StorageShedID, tblCustomers.CustomerID, tblRentals.BeginningDate, tblRentals.EndingDate, tblRentals.PaymentDate, tblRentalRate.RentalRate, tblRentals.PaymentMade, tblRentals.PaymentBalanceDue, tblPaymentType.PaymentType, tblRentals.CheckNumber, tblCreditCardType.CreditCardName, tblRentals.CreditCardNumber, tblRentals.MoneyOrderNumber, tblRentals.LateCharges
FROM tblCreditCardType INNER JOIN (tblStorageUnits INNER JOIN (tblRentalRate INNER JOIN (tblPaymentType INNER JOIN (tblCustomers INNER JOIN tblRentals ON tblCustomers.CustomerID = tblRentals.CustomerID) ON tblPaymentType.PaymentTypeID = tblRentals.PaymentTypeID) ON tblRentalRate.RentalRateID = tblRentals.RentalRateID) ON tblStorageUnits.StorageShedID = tblRentals.StorageShedID) ON tblCreditCardType.CreditCardNameID = tblRentals.CreditCardNameID;
SELECT tblRentals.RentalID, tblStorageUnits.StorageShedID, tblCustomers.CustomerID, tblRentals.BeginningDate, tblRentals.EndingDate, tblRentals.PaymentDate, tblRentalRate.RentalRate, tblRentals.PaymentMade, tblRentals.PaymentBalanceDue, tblPaymentType.PaymentType, tblRentals.CheckNumber, tblRentals.CreditCardNameID, tblRentals.CreditCardNumber, tblRentals.MoneyOrderNumber, tblRentals.LateCharges
FROM tblStorageUnits INNER JOIN (tblRentalRate INNER JOIN (tblPaymentType INNER JOIN (tblCustomers INNER JOIN tblRentals ON tblCustomers.CustomerID = tblRentals.CustomerID) ON tblPaymentType.PaymentTypeID = tblRentals.PaymentTypeID) ON tblRentalRate.RentalRateID = tblRentals.RentalRateID) ON tblStorageUnits.StorageShedID = tblRentals.StorageShedID;
relationships
Attachment 2039
I can attach an excel file with all the tables or if allowed a copy of the db. Any suggestions?