#1054 - “群组声明”中的未知列

时间:2017-07-18 22:17:12

标签: mysql sql

我有这个Sql查询

SELECT tt.ID_Partenaire, tt.Nom_Societe,tt.Image_Societe, tt.id_activite 
                FROM affiliate AS a 
                RIGHT JOIN 
                  (SELECT p.ID_Partenaire, p.Nom_Societe, p.Image_Societe,p.id_activite,
                        IFNULL(SUM(c.montant_real),0) AS mt1 
                    FROM partenaires as p 
                        LEFT JOIN commande AS c 
                    ON p.ID_Partenaire=c.id_partenaire 
                    GROUP BY P.ID_Partenaire 
                  )AS tt 
            ON a.id_partenaire= tt.ID_Partenaire 
            GROUP BY tt.ID_Partenaire 
            ORDER BY (IFNULL(SUM(a.montat),0) + mt1) DESC 
            LIMIT 20

我有两台服务器:

  1. Version du serveur:5.7.11-log - MySQL社区服务器(GPL) - 本地 -
  2. 服务器版本:10.1.25-MariaDB-1~jessie - mariadb.org二进制发行版 - 主机 -
  3. 当我在server1上执行它时它会给我一个正确的结果但是在server2上它给出了错误#1054 - 'group statement'中的未知列'P.ID_Partenaire'

    解决方案是组中的小写P

    我还有一个问题是服务器之间的结果不一样,即使它们具有相同的数据库

1 个答案:

答案 0 :(得分:1)

问题是使用P作为P.ID_Partenaire表的别名,并在组声明(const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.placeDataUpdated = functions.database.ref('/places/{placeId}').onUpdate(event => { const place = event.data.val(); const key = event.params.placeId; console.log("Updated place data for key: ", key); var dataToUpdate = {}; dataToUpdate["places_summary/"+key+"/city"] = place.city; dataToUpdate["places_summary/"+key+"/country"] = place.country; dataToUpdate["places_summary/"+key+"/latitude"] = place.latitude; dataToUpdate["places_summary/"+key+"/longitude"] = place.longitude; dataToUpdate["places_summary/"+key+"/name"] = place.name; dataToUpdate["places_summary/"+key+"/numReviews"] = place.numReviews; dataToUpdate["places_summary/"+key+"/placeScore"] = place.placeScore; dataToUpdate["places_summary/"+key+"/products"] = place.products; dataToUpdate["places_summary/"+key+"/visible"] = place.onMap; dataToUpdate["places_GeoFire/"+key+"/l/0"] = place.latitude; dataToUpdate["places_GeoFire/"+key+"/l/1"] = place.longitude; return event.data.ref.parent.parent.update(dataToUpdate); }); )中使用const ProgressBar = (props, {...customProps}) => { const GroupProgressBar = []; props.groups.map((group, i) => { const widthValue = (group.value / group.max) * 100; GroupProgressBar.push (<div style={{ width: `${widthValue}%`, animationDelay: /* based on the concept number */, zIndex: /* based on the concept number */ }} key = {i} className={`well-background--${group.concept} animation terra-ProgressGroup--progress terra-ProgressBar--${props.heightSize}`}> </div>); }) return <div className='terra-ProgressGroup'> {GroupProgressBar} </div> } (大写)。

尝试标准化,不要混合大小写。

另外,请记住,SQL命令在DBMS之间有所不同......