Hi, I want to insert multiple products, units, quantities, related dates for the same purchase order and then show them within the same row in a table, but I can not find how to do it. Basically it is a system to capture orders.
To be more clear that if they had the same purchase order they will be put together in the same row of the table, and the products, units, quantities, etc, will be shown together with the same purchase order and the others separated but within the same order. table. Over there I read that it is bad to use arrays inside the database since the same database is like an array. I leave my tables:
CREATE TABLE capturar_pedido (
cliente varchar(255) NOT NULL,
orden_de_compra varchar(255),
producto varchar(255) NOT NULL,
unidad varchar(255) NOT NULL,
cantidad varchar(255) NOT NULL,
fecha_de_embarque Date NOT NULL,
notas varchar(255),
etiquetado char(2) NOT NULL,
id_pedido BIGINT(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id_pedido)
)
CREATE TABLE salida_materiales (
folio varchar(255) NOT NULL,
fecha Date NOT NULL,
numero_remision varchar(255),
numero_factura varchar(255),
otro varchar(255),
referencia_transporte varchar(255),
placa_tractor varchar(255),
placa_caja varchar(255),
comentarios varchar(255),
retorno char(2),
fecha_posible Date NOT NULL,
orden_de_compra varchar(255) not null UNIQUE,
id_materiales BIGINT(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id_materiales),
FOREIGN KEY(orden_de_compra) references capturar_pedido(orden_de_compra))
CREATE TABLE coa (
fecha Date NOT NULL,
presentacion varchar(255) NOT NULL,
cantidad varchar(255) NOT NULL,
oc varchar(255),
lote varchar(255) NOT NULL,
produccion varchar(255) NOT NULL,
caducidad varchar(50) NOT NULL,
sello varchar(255),
apariencia varchar(255),
resultado_apariencia varchar(255),
sabor varchar(255),
resultado_sabor varchar(255),
olor varchar(255),
resultado_olor varchar(255),
color varchar(255),
resultado_color varchar(255),
pureza varchar(255),
resultado_pureza varchar(255),
humedad varchar(255),
resultado_humedad varchar(255),
id_pedido Bigint(10) not null UNIQUE,
id_coa BIGINT(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id_coa),
FOREIGN KEY(id_pedido) references capturar_pedido(id_pedido)
)
CREATE TABLE granulometria (
parametro varchar(255),
unidad varchar(255),
especificacion varchar(255),
resultado varchar(255),
id_pedido int(10) not null,//hacerla foreign key pero no unica
id_granulometria BIGINT(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id_granulometria)
)