1

如何value在 MySql 的 select 语句中使用?它是保留关键字。

代码:

SELECT unit.cleunit
 FROM    (   (   metas metas
           INNER JOIN
              metas_unit metas_unit
           ON (metas.clemetaunit = metas_unit.clemetaunit))
       INNER JOIN
          metas_values metas_values
       ON (metas_values.clemetaunit = metas.clemetaunit)
      AND (metas_unit.clemetaunit_values =
              metas_values.clemetaunit_values))
   INNER JOIN
      unit unit
   ON (unit.cleunit = metas_unit.cleunit)

WHERE (unit.etatunit <> 0) AND (unit.isdeleteunit = 0) AND ((metas_unit.LIKE value'%%NOM%%') OR (metas_values.metavalues_name LIKE '%%NOM%%'))

4

1 回答 1

4

尝试以下操作:

SELECT * FROM MyTable WHERE `Value` = 1

有关详细信息,请参阅保留字和标识符

更新:sql查询:

SELECT unit.cleunit
FROM metas
INNER JOIN metas_unit 
    ON metas.clemetaunit = metas_unit.clemetaunit
INNER JOIN metas_values 
    ON metas_values.clemetaunit = metas.clemetaunit
    AND metas_unit.clemetaunit_values = metas_values.clemetaunit_values
INNER JOIN unit
    ON unit.cleunit = metas_unit.cleunit
WHERE unit.etatunit <> 0 
    AND unit.isdeleteunit = 0 
    AND (metas_unit.`value` LIKE '%%NOM%%' 
         OR metas_values.metavalues_name LIKE '%%NOM%%')
于 2012-04-19T04:18:46.543 回答