Wizard
Wizard

Reputation: 1162

SQL functional Error

I'm fairly new to MySQL and am using MySQL to work on a project based on an ordering system.

What's I have is a table for:

Session Table:
PK Session_ID
Date: Session_Date 

Delivery Table:
PK: Del_Type (eg. Firstclass, Secondclass)
Int: Del_TimeToDeliver (1, 2, 3, these represent the expected time to deliver)

Order Table: 
PK: Order_ID: autonum + 1
FK: Order_Delivery_ID
Date: Order_EstDelivery

What I'd like to do with adding an order is to calculate the estimated time based on the session ID is essentially:

Order_EstDelivery = (Session Date + Delivery_TimeToDeliver) 

I have got this code:

INSERT INTO rbickers.order(Del_Type, Order_EstDelivery)
SELECT Del_Type, Ses_Date + INTERVAL Del_TimeToDeliver DAY
FROM Session
LEFT JOIN rbickers.delivery ON Del_Type = ("SecondClass")
WHERE Ses_ID = 2

but it's returning an error on: Unknown column 'Del_Type' in field list.

I don't understand the error.

Upvotes: 0

Views: 49

Answers (2)

Mihai
Mihai

Reputation: 2760

The "Session" table doesn't contain the column "Del_Type" so you can't run a "Join" on it

Upvotes: 0

hkutluay
hkutluay

Reputation: 6944

As far as i see, there is no Del_Type column exists in order table. You can not insert a value to column that doesn't exists in table schema.

INSERT INTO rbickers.order(Del_Type, Order_EstDelivery)

Upvotes: 1

Related Questions