MySQL error: # 1248 - Each view must have its own alias

How can I fix this error by setting an alias? : # 1248 - Each view 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' 
+7
source share
2 answers

Well, as the error says, you should name each view. For example,

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

It is a view. Add a name like this:

 (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 as between the bracket and the name, but I suppose you can try this or look from here;))

Your next question (how long will we do this? :))

  WHERE title LIKE %Member% 

it should be

 WHERE title LIKE '%Member%' 
+18
source
 SELECT ect.entry_id, ect.author_id, ect.title, ect.status FROM exp_channel_titles as ect 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) as ecd ON ecd.entry_id = ect.entry_id LEFT JOIN (SELECT member_id, email FROM exp_members) as exm ON exm.member_id = ect.author_id WHERE ect.title LIKE '%Member%' AND ect.status = 'complete' 
+1
source

All Articles