简体   繁体   中英

Invalid column name error when column exists

I keep trying to run this query but it keeps telling me the column name does not exist when it clearly does: first_name proof this is driving me mad what am i doing wrong?

SELECT customers.customer_id, orders.order_id, orders.date_ordered, orders.order_total, orders.collection_method, orders.staff_id
FROM customers INNER JOIN orders on customers.customer_id = orders.customer_id
WHERE first_name = James

You should escape string values with single quotes:

WHERE first_name = 'James'

Otherwise, they are treated as identifiers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2025 STACKOOM.COM