简体   繁体   中英

SQL Join failing with CodeIgniter

Im trying to join two tables but cannot seem to figure out how to resolve this error: This is the code generated from CodeIgniter:

SELECT `proc`.* FROM (`deliverycheck_proc_entries` proc) 
LEFT OUTER JOIN `deliverycheck_proc_entries` 
ON `proc`.`raw_entry_id` = `deliverycheck_raw_entries`.`id` 
WHERE `proc`.`status` > '1' 
ORDER BY `id` asc LIMIT 10

My error:

Error Number: 1054
Unknown column 'deliverycheck_raw_entries.id' in 'on clause'

I need all the columns from deliverycheck_proc_entries and specific from deliverycheck_raw-entries .

change

LEFT OUTER JOIN `deliverycheck_proc_entries` 

to

LEFT OUTER JOIN `deliverycheck_raw_entries` 

Edit

SELECT proc.*, raw.* 
FROM deliverycheck_proc_entries `proc`
LEFT OUTER JOIN deliverycheck_raw_entries raw
ON proc.raw_entry_id = raw.id 
WHERE proc.status > '1' 
ORDER BY proc.id ASC
LIMIT 10

可能是一个拼写错误,但你已经加入deliverycheck_proc_entries而不是deliverycheck_raw_entries

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-2024 STACKOOM.COM