My query returns with this error:
Unknown column 'u.user_id' in 'on clause'
Here's the query:
Here's the table schema:
My table clearly has a user_id column. I cannot figure out why i continue to get this error.
Unknown column 'u.user_id' in 'on clause'
Here's the query:
Code:
SELECT u.user_id AS id, a.affiliate_id AS a_id,
u.phone, u.city, u.state, u.email,
a.company, a.username, a.contact, a.address, a.zip, a.subscribed,
i.image_id as storefront
FROM `user` u, affiliate a
LEFT JOIN image i ON i.user_id = u.user_id
WHERE a.affiliate_id='1' AND u.affiliate_id = a.affiliate_id AND i.deleted IS NULL;
Here's the table schema:
Code:
CREATE TABLE `user` (
`user_id` int(11) NOT NULL auto_increment,
`affiliate_id` int(10) default '0',
`firstname` varchar(100) default '',
`lastname` varchar(100) default '',
`city` varchar(100) NOT NULL default '',
`state` varchar(2) NOT NULL default '',
`phone` varchar(20) NOT NULL default '',
`email` varchar(255) NOT NULL default '',
`password` varchar(50) NOT NULL default '',
`role_id` int(10) NOT NULL default '2',
`hash` varchar(50) NOT NULL default '',
`date` timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`verified` int(11) NOT NULL default '0',
PRIMARY KEY (`user_id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
My table clearly has a user_id column. I cannot figure out why i continue to get this error.