-1
2つのクエリを1つにすることはできますか?事前SQL DISTINCTサブクエリ
$colname_Recordset_hot = "-1";
if (isset($_GET['Search'])) {
$colname_Recordset_hot = $_GET['Search'];
}
$colnamef1_Recordset_hot = "%";
if (isset($_GET['f1'])) {
$colnamef1_Recordset_hot = $_GET['f1'];
}
mysql_select_db($database_con_amazing, $con_amazing);
$query_Recordset_hot = sprintf("SELECT * FROM Hotel WHERE publish = 1 AND ad_country LIKE %s AND tag_1 LIKE %s OR ad_city LIKE %s OR category LIKE %s OR name LIKE %s OR tag_1 LIKE %s OR tag_2 LIKE %s OR tag_3 LIKE %s", GetSQLValueString("%" . $colname_Recordset_hot . "%", "text"),GetSQLValueString("%" . $colnamef1_Recordset_hot . "%", "text"),GetSQLValueString("%" . $colname_Recordset_hot . "%", "text"),GetSQLValueString("%" . $colname_Recordset_hot . "%", "text"),GetSQLValueString("%" . $colname_Recordset_hot . "%", "text"),GetSQLValueString("%" . $colname_Recordset_hot . "%", "text"),GetSQLValueString("%" . $colname_Recordset_hot . "%", "text"),GetSQLValueString("%" . $colname_Recordset_hot . "%", "text"));
$Recordset_hot = mysql_query($query_Recordset_hot, $con_amazing) or die(mysql_error());
$row_Recordset_hot = mysql_fetch_assoc($Recordset_hot);
$totalRows_Recordset_hot = mysql_num_rows($Recordset_hot);
mysql_select_db($database_con_amazing, $con_amazing);
で
多くのおかげで私は、SELECT DISTINCT TAG_1欄に追加の結果を取得したいと思いますが、二度同じクエリを実行する必要はありません。
あなたの質問を編集し、取得したい結果を表示してください。 –
質問は少なくとも私にとっては不明です。あなたはいくつかのサンプルデータと達成しようとしている結果を共有していただけますか? – Mureinik
2つの異なるレコードセットを返すストアドプロシージャを作成できます。 –