Quote:
Originally Posted by Mitch100degrees
Okay, assume you have a blog where multiple authors can get credit for one entry and you store their userids in a field titled userids separated by commas like this: 1, 368, 9841
|
Well I wouldn't have done that for a start.
Set up another table with one line for blog id with a single userid, with multiple rows for multiple users. Either not bother with a primary key or set up a dummy auto-increment field if not having a primary keys gives you the willies (still index both fields)
then you can do
SELECT blogstable.*, group_concat(distinct usertable.username)
FROM blogstable
JOIN blogusers USING (bid)
JOIN usertable on (usertable.userid = blogusers.userid)
WHERE blogstable.bid = 1
GROUP BY blogstable.bid
Quote:
My question to you is, is there anyway to avoid the full table scan that you know of
|
Not if you are using find_in_set there isn't.