从表中选择列a不等于列b(在同一个表上)和tableID = 2

时间:2016-02-06 11:08:48

标签: php mysql

select from table where column a is not equal column b (on same table) and tableID = 2

任何人都可以给我一个简单的代码。

<?php
$query_myslot = "select from table where column a is not equal column b (on same table) and tableID = 2";
$myslot = mysql_query($query_myslot, $localhost) or die(mysql_error());
$row_myslot = mysql_fetch_assoc($myslot);
$totalRows_myslot = mysql_num_rows($myslot);
?>

1 个答案:

答案 0 :(得分:0)

尝试更改您的查询,如下所示:

select * from tablename where column1 <> column2  and tableID = 2