Guest User

Untitled

a guest
Nov 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. SELECT items.*, quantity_table.quantity1 FROM items JOIN quantity_table WHERE id_item = 3 AND id_quant = 1
  2.  
  3. select i.id_item as item_id, name as item_name, type as item_type, qty as item_qty
  4. from accounts as a
  5. inner join equipment as e
  6. on a.id_acc = e.id_acc
  7. inner join items as i
  8. on e.id_item = i.id_item
  9. where a.id_acc = 1
  10.  
  11. CREATE TABLE item_quantity(
  12. id_item INT NOT NULL,
  13. id_quant INT NOT NULL,
  14. CONSTRAINT id_item_quantity PRIMARY KEY (id_item,id_quant),
  15. CONSTRAINT fk_id_item FOREIGN KEY (id_item)
  16. REFERENCES items(id_item),
  17. CONSTRAINT fk_id_quant FOREIGN KEY (id_quant)
  18. REFERENCES quantity_table(id_quant));
  19.  
  20. 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