-2
Could someone explain to me why this query does not work?
select mensagem.mnsg, aluno.nome as nomea, aluno.curso as cursoa
from mensagem
inner join aluno on aluno.rm=mensagem.RM
order by id asc;
-- Table aluno
CREATE TABLE `aluno` (
`RM` INT(11) NOT NULL,
`Turma_ID` INT(11) NOT NULL DEFAULT '0',
`Foto` TINYBLOB NULL,
`Nome` VARCHAR(50) NULL DEFAULT NULL,
`Email` VARCHAR(50) NULL DEFAULT NULL,
`Senha` VARCHAR(50) NULL DEFAULT NULL,
PRIMARY KEY (`RM`),
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;
-- Table mensagem
CREATE TABLE `mensagem` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`RM` INT(11) NOT NULL,
`mnsg` TEXT NULL,
`RM_PROF` INT(11) NULL DEFAULT NULL,
`Turma_ID` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`ID`)
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
AUTO_INCREMENT=3
;
-- Table turma
CREATE TABLE `turma` (
`Turma_ID` INT(11) NOT NULL DEFAULT '0',
`curso` VARCHAR(50) NULL DEFAULT NULL,
`ano` INT(11) NULL DEFAULT NULL,
`QNT_ALUNO` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`Turma_ID`)
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;
Returns an error?
– Kayo Bruno
But the select is there friend :(
– CarlosAugusto11
The error returned is in the title, 1054
– CarlosAugusto11
Try this: select message.mnsg, message.RM, student.name names them, student.course to courses, student.rm from message Inner Student on student.rm=message.RM order by id asc;
– Kayo Bruno
Ops, as I was not in the same format, I ended up not seeing, it was bad, I will delete my comment.
– Roberto de Campos
I’m getting a lot of negative votes, which I did wrong?
– CarlosAugusto11
When things are too basic or asked to do the code, usually people don’t like it and negatively. In your case I believe it was lack of attention to solve the problem, stay more attentive to the structure of the comic
– V.Avancini
I get it, thank you
– CarlosAugusto11
I don’t know if that’s the case, but there’s a chat option on Stack, I believe it serves that purpose too.
– Marcos Xavier