Maison  >  Questions et réponses  >  le corps du texte

mysql contient la colonne inconnue 'a.plat' dans la clause ON

select truncate(a.lat, 2) as plat, truncate(a.lng, 2) as plng, temp.latt, temp.lngt from user_post as a inner join 
(select truncate(user_post.lat, 2) as latt, truncate(user_post.lng, 2) as lngt from user_post group by latt, lngt having count(latt) >= 4 and count(lngt)>= 4) as temp 
on (a.plat = temp.latt and a.plng = temp.lngt);

Pourquoi une telle erreur est-elle signaléeunknown column 'a.plat' in ON clause  ?

漂亮男人漂亮男人2668 Il y a quelques jours1007

répondre à tous(1)je répondrai

  • phpcn_u1582

    phpcn_u15822017-06-30 09:56:48

    aL'alias pointe vers la table user_post. À en juger par votre déclaration, la table user_post a un champ lat mais pas de champ plat.
    Donc, a.plat dans la condition on est faux.

    Essayez d'ajouter des parenthèses :

    select a.plat, a.plng, temp.latt, temp.lngt 
    
    from 
    
    (select truncate(lat, 2) as plat, truncate(lng, 2) as plng from user_post) as a 
    
    inner join 
    
    (select truncate(lat, 2) as latt, truncate(lng, 2) as lngt from user_post group by latt, lngt having count(latt) >= 4 and count(lngt)>= 4) as temp 
    
    on a.plat = temp.latt and a.plng = temp.lngt;
    

    répondre
    0
  • Annulerrépondre