caman Posted April 22, 2009 Posted April 22, 2009 Hello. I do have, in my db, a single table. I have the fields: "ID" "Productnumber" "Location" "In_Stock" "Total_Locations" My question is; I have several productnumbers, both with and without letters/ numbers, but they are not unique. Each Productnumber is given a location. Each location is not unique to that productnumber. But, I might have the same productnumber several times, but with different locations. I need the field "Total_Locations" to count the number of unique locations, for each Productnumber. I.E. I have: PO# "920-580" on both Location "H1" and "291504". The "Total_Locations" would be 2. PO# "MayOS" is located only on Location "VM2". The "Total_Locations" would be 1. You get my drift? Regards Christian
Breezer Posted April 22, 2009 Posted April 22, 2009 (edited) Assuming the PO# is in the "Productnumber" field and the ID is a unique not empty field, you could create a self relationship based on "Productnumber" Then, make the field "Total_Locations" a calculation such as Total_Location = count(Location_self::ID) Edited April 22, 2009 by Guest self is reserved
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now