开发者

how to select those rows where x > y

Does anyone know how to select those rows where x > y, where 开发者_如何学JAVAx and y both are table columns.

$query = mysql_query("SELECT * FROM table WHERE x > '???' ");


To get all rows where the column x value is greater than that in column y it is this simple.

SELECT * /*BTW - Don't use *. List desired columns explicitly*/
FROM table 
WHERE x > y;


You can specify column names anywhere a value would be valid, even on both sides of a relational operator.

SELECT *
  FROM table
  WHERE x > y
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜