0

我想显示表格中的记录,除了几列。该表中有 94 列,我想查看除 5 之外的所有列。这可能吗?如果是这样,请告诉我如何?

我知道我可以通过指定它们来选择所需的列。但是我想在 94 列中省略 5 列。省略 5 总是比指定 89 更好?

我用谷歌搜索,但我不知道这样做。所以我只想在这里做最后一次尝试!

4

1 回答 1

-1
$Database_Name="database_example";
$table_example="table_example";
$result = mysql_query("select column_name from information_schema.columns where table_schema = '$Database_Name' and table_name='$table_example' AND column_name NOT IN ('Col89', 'col90','col91','col92', 'col93','col94')");

if (!$result) { 
    die('Invalid request : ' . mysql_error());
}

$SQL="SELECT ";
while ($row = mysql_fetch_row($result)) {   
    foreach($row as $ColonneName)
        $SQL.=$ColonneName.",";
}   

$SQL=rtrim($SQL, ",")." FROM _table_example";

    echo $SQL;
于 2012-12-11T10:21:46.510 回答