
Adonis Perez Perez Farias
PreguntaERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘p.id_producto=f.id_producto’ at line 1
create table CLIENTES(
ID_CLIENTE INT AUTO_INCREMENT PRIMARY KEY,
NOMBRE CHAR(100) NOT NULL,
CEDU_RIF CHAR(20) NOT NULL,
TELEFONO CHAR(20),
DIRECCION CHAR(100)
);
insert into CLIENTES(ID_CLIENTE, NOMBRE,CEDU_RIF,TELEFONO,DIRECCION) VALUES(
1,
‘adonis perez’,‘23917268’,‘04149842782’,‘avenida orinoco nro 304-A’),(2,
‘restaurant los cindo mejores sabores c.a’,‘j-2979708212-3’,‘0291622320’,‘avenida orinoco casa 304-A’);
create table PRODUCTOS(
ID_PRODUCTO INT auto_increment PRIMARY KEY,
NOMBRE varchar(30) NOT NULL,
PRECIO_SIN_IVA DECIMAL(20,2) NOT NULL,
IVA DECIMAL(10,2) NOT NULL,
PRECIO_CON_IVA DECIMAL(20,2) NOT NULL
);
INSERT INTO PRODUCTOS(ID_PRODUCTO, NOMBRE, PRECIO_SIN_IVA, IVA, PRECIO_CON_IVA)
VALUES(1,‘COCACOLA 355ML’,1300.33,233.43,2000.00),(2,‘PABELLON’,2000.43,3000.00,25000.00);
CREATE TABLE FACTURA(
ID_FACTURA INTEGER unsigned auto_increment PRIMARY KEY,
CANTIDAD int unsigned NOT NULL,
SUB_TOTAL DECIMAL(65,2) not null,
IVA DECIMAL(20,2) NOT NULL,
MONTO_TOTAL DECIMAL(65,2) not null,
ID_CLIENTE INT unsigned not null,
ID_PRODUCTO INT unsigned NOT NULL
);
insert into factura(cantidad, sub_total, iva, monto_total, id_cliente, id_producto) values(3, 13500, 3500, 13500, 1,1),(4,3000,3200,3222,2,2);
select f.id_factura, f.cantidad,f.sub_total,f.iva, monto_total,c.nombre,
c.cedu_rif,
c.telefono,
p.nombre
from factura as f
left join clientes as c
on c.id_cliente=f.id_cliente
left join productos as p
on p.id_producto=f.id_producto;

Alexander Armúa Abregu
Hola!
Te comento, que yo no tuve problemas (solo 1 pequeño).
Me trajo esto:
Lo que hice, fue reemplazar todas las comillas que pusiste por comillas simples.
Osea:
* ‘ * => * ' *
Y con eso ejecuto perfecto.
Espero que te haya servido. Saludos!