开发者

On MYSQL Join, I'm getting un unknown column error

开发者 https://www.devze.com 2022-12-31 05:10 出处:网络
Here is my query: select s.*, u.display_name from wp_wdify_sites s, wp_users u LEFT JOIN wp_wdify_sitesmeta m ON (s.sid = m.site_id)

Here is my query:

   select s.*,
          u.display_name 
     from wp_wdify_sites s, 
          wp_users u
LEFT JOIN wp_wdify_sitesmeta m ON (s.sid = m.site_id)
    where milestones like '%dateSubmitted%' 
      and milestones not like '%dateArchived%' 
      and u.ID = s.cid and did IN (0)
      and m.meta_key = 'aboutSite'`

The error I'm getting is #1054 - Unknown column 's.sid' in 'on clause'. The problem is, wp_wdify_sites.sid definit开发者_运维百科ely does exist. It doesn't make sense.


try something like this :

    select s.*,
           u.display_name 
      from wp_users u 
INNER JOIN wp_wdify_sites s ON u.ID = s.cid 
 LEFT JOIN wp_wdify_sitesmeta m ON (s.sid = m.site_id) 
     where milestones like '%dateSubmitted%' 
       and milestones not like '%dateArchived%' 
       and did IN (0) 
       and m.meta_key = 'aboutSite'

your LEFT JOIN ON clause is in the wrong place for joining wp_wdify_sites and wp_wdify_sitesmeta.

0

精彩评论

暂无评论...
验证码 换一张
取 消