Jump to content

Multi-Predicate or Alternative Key


Ocean West

This topic is 2974 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Basic database

Customer --< Location ---< Invoices

UID keys to foreign keys pretty typical...

However the billing company is changing for many locations - it was a distributorship that is winding down and each location are going to be billed directly..

To preserve historical data. one thought would be to ad a multi predicate between locations and Invoices so that oldCustomer / location invoices remain linked and when the new   customer UID is assigned to the location only new invoices are connected.

other though was to add GetContainerAttribute ( List ( customer_UID ; location_id)  ; "md5" ) to the location table and use that as the key between location & invoice.

they both do the trick but I am probably making it much more convoluted then need be.

OR

the real solution would be to create a script to duplicate the location assign a new customer - and then setting status on the prior customer / location to closed. and of course script duplicate all the associated tables that are needed for future invoices. But then trying to consolidate reports by location / company will be fun. 

 

Link to comment
Share on other sites

This topic is 2974 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.