我有一个包含61列的表。
在select语句中,我想获取除了其中两个列之外的所有列。
我该怎么做?
以下是从表中提取数据的代码:
function hotelfeature($id)
{
global $conn;
$selFeature = "select * from hotelpropertyoptioninfo where Hotel_id = " .$id;
$resultFeature = mysql_query($selFeature,$conn);
$rowFeature = mysql_fetch_assoc($resultFeature);
return $rowFeature;
}
答案 0 :(得分:0)
SET @SQL = CONCAT('SELECT ', (SELECT GROUP_CONCAT(COLUMN_NAME) FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = '<table>' AND COLUMN_NAME NOT IN ('field1','Field2')),
' FROM <table>');
PREPARE stmt1 FROM @SQL;
EXECUTE stmt1;