mySQL error: #1248 - Every derived table must have its own alias

mysql

Solution

Well, as the error says, you have to name every derived table. For instance

(SELECT   
    member_id,
    email
FROM exp_members
WHERE member_id = exp_channel_titles.author_id)

Is a derived table. Add a name like so:

(SELECT   
    member_id,
    email
FROM exp_members
WHERE member_id = exp_channel_titles.author_id) tempTableNameGoesHere

(I think I'm sure there is no need for an `as` between the bracket and the name, but I suppose you can try it, or look it up from here ;) )

Your follow-up question (how long are we going to do this? :) )

 WHERE title LIKE %Member% 

should be

WHERE title LIKE '%Member%'

Problem

How would I correct this error by setting an alias? error: #1248 - Every derived table must have its own alias ``` SELECT entry_id, author_id, title, status FROM exp_channel_titles LEFT JOIN (SELECT entry_id, field_id_14, field_id_15, field_id_25, field_id_27, field_id_28, field_id_29, field_id_30, field_id_31, field_id_32, field_id_33, field_id_34, field_id_35 FROM exp_channel_data WHERE entry_id = exp_channel_titles.entry_id) LEFT JOIN (SELECT member_id, email FROM exp_members WHERE member_id = exp_channel_titles.author_id) WHERE title LIKE %Member% AND status = 'complete' ```

Original source