I'm trying to filter the table collections by id and then join the collections.user_id on users.user_id.
Here is the query I've tried
SELECT * FROM
(SELECT * FROM collections WHERE mid=`$id`) c
JOIN users on c.mid = users.user_id ORDER BY users.user_id
Haven't managed to get it work obviously. Any help or pointers would be appreciated!
CREATE TABLE `collections` (
`user_id` int(11) NOT NULL,
`mid` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`api_public` varchar(32) DEFAULT NULL,
`api_secret` varchar(32) NOT NULL,
UNIQUE KEY `unique id` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;