As Rudy suggested, here is more info…
- The context:
I am building a set of applications for artists to keep track of their stuff. Most make items that are one off (ie a pot, a painting, a piece of wood or metal. Some, make limited editions of stuff, like 25 copies of the same image.
For this latter group, I have to be able to show where they are in making these limited editions.
Thus, I need to show that a specific item is made/printed, and is sold, or on consignment…
I must also validate to ensure that if a limited edition has a maximum run of 25 items, that that limit is not exceeded - you cant enter record 26 of 25.
My tables and basic record data:
CREATE TABLE negatives
( negative_serial_no INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY
, print_title VARCHAR(50)
) ENGINE=InnoDB
;
CREATE TABLE editions
( edition_serial_no INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY
, negative_serial_no INTEGER NOT NULL
, edition_size TINYINT NOT NULL
) ENGINE=InnoDB
;
CREATE TABLE prints
( print_key INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY
, edition_serial_no INTEGER NOT NULL
, print_serial_no TINYINT
) ENGINE=InnoDB
;
INSERT INTO negatives VALUES
( 10001,'nom nom nom' )
,( 10002,'ur doing it wrong' )
,( 10003,'imaginary bicycle' )
;
INSERT INTO editions VALUES
( 35,10001,25 )
,( 36,10002,10 )
,( 37,10002,10 )
;
INSERT INTO prints VALUES
( 935,35,1 )
,( 936,35,2 )
,( 937,37,1 )
;
- Status
I have a field in the editions table that sets the maximum size of the edition.
, edition_size TINYINT NOT NULL
I have a print_serial_number
, print_serial_no TINYINT
- The brain damage:
I am trying to show in a report:
“This is record prints.print_serial_no of editions.edition_size”
I’m stuck on how to make that simple line…