Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT items.*, quantity_table.quantity1 FROM items JOIN quantity_table WHERE id_item = 3 AND id_quant = 1
- select i.id_item as item_id, name as item_name, type as item_type, qty as item_qty
- from accounts as a
- inner join equipment as e
- on a.id_acc = e.id_acc
- inner join items as i
- on e.id_item = i.id_item
- where a.id_acc = 1
- CREATE TABLE item_quantity(
- id_item INT NOT NULL,
- id_quant INT NOT NULL,
- CONSTRAINT id_item_quantity PRIMARY KEY (id_item,id_quant),
- CONSTRAINT fk_id_item FOREIGN KEY (id_item)
- REFERENCES items(id_item),
- CONSTRAINT fk_id_quant FOREIGN KEY (id_quant)
- REFERENCES quantity_table(id_quant));
- SELECT items.id_item,items.name,quantity_table.quantity FROM item_quantity Inner Join items ON item_quantity.fk_id_item = items.id_item Inner Join quantity_table ON item_quantity.fk_id_quant = quantity_table.id_quant
Add Comment
Please, Sign In to add comment