mattibutt
asked on
mysql join
hi
i want to join two tables together currently i am selecting from the code table
SELECT userip, datef, quiz, username, sum(category) as category, count(qid) as qid FROM codes group by quiz,username ORDER BY category
but i also wants to select fields from the enterused table where code and enterused table quiz value is the same
CREATE TABLE `enterused` (
`id` int(10) NOT NULL auto_increment,
`randomcode` varchar(100) NOT NULL,
`category` varchar(50) NOT NULL,
`quiz` varchar(100) NOT NULL,
`datef` varchar(30) default NULL,
`type` int(10) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;
i want to join two tables together currently i am selecting from the code table
SELECT userip, datef, quiz, username, sum(category) as category, count(qid) as qid FROM codes group by quiz,username ORDER BY category
but i also wants to select fields from the enterused table where code and enterused table quiz value is the same
CREATE TABLE `enterused` (
`id` int(10) NOT NULL auto_increment,
`randomcode` varchar(100) NOT NULL,
`category` varchar(50) NOT NULL,
`quiz` varchar(100) NOT NULL,
`datef` varchar(30) default NULL,
`type` int(10) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER