hsi
hsi

Reputation: 97

how to fix Error Code: 1054. Unknown column in my sql

i write below code and i have Error Code: 1054. Unknown column 'referenceinfo.mid' in 'on clause'
create table newenron as SELECT employeelist.eid ,employeelist.firstName ,employeelist.lastName ,employeelist.Email_id ,employeelist.status ,message.mid ,message.sender ,message.subject ,message.body ,message.folder ,recipientinfo.rid ,recipientinfo.mid ,recipientinfo.rvalue ,referenceinfo.rfid ,referenceinfo.mid ,referenceinfo.reference FROM employeelist INNER JOIN message ON employeelist.Email_id = message.sender INNER JOIN recipientinfo ON message.mid = referenceinfo.mid INNER JOIN referenceinfo ON recipientinfo.rid = referenceinfo.rfid how can i fix it? thank for your taking time.

Upvotes: 0

Views: 1768

Answers (2)

Floaterz
Floaterz

Reputation: 128

Here

 INNER JOIN recipientinfo ON message.mid = referenceinfo.mid

you are joining the table recipientinfo but make reference to referenceinfo?

From what I could tell,

  • recipientinfo
  • referenceinfo

Are two different tables.

What you probably want is

INNER JOIN recipientinfo ON message.mid = recipientinfo.mid

or

INNER JOIN referenceinfo ON message.mid = referenceinfo.mid

Upvotes: 0

Ervin Cosic
Ervin Cosic

Reputation: 114

You misspelled a column name. But from this I can't see which one.

Upvotes: 1

Related Questions