mysql - Error on SQL Server tables while performing a join -
i'm trying perform join between 4 tables schedule table, employee table, machine table , plate table.
problem is, @ schedule table primary key date while on rest of table have primary key char. i'm trying convert primary key in table char make same 1 on others don't know how. here have done far
create table machine ( machineid char(5), machinetype varchar(10) not null, machinestatus varchar(10)not null ) create table employee ( employeeid char(5) primary key, employeename varchar(30) not null, ) create table plate ( plateid char(5) primary key, platemodel varchar(30) not null, ) create table machineschedule ( dateschedule date primary key, )
here join
select employee.employename, plate.platemodel, machine.machineid, machine.machinetype, machine.machinestatus employee, plate, machine join machineschedule on machineschedule.dateschedule=machine.machineid;
and here error gave conversion failed when converting date and/or time character string.
your table structure incorrect, should use integer datatype primary key not char or datetime creates indexing , can not join table on char , date datatype never have same value; , lastly join other tables in clause. there should join condition employee, plate, machine.
and primary , foreign key constraints missing
Comments
Post a Comment