Breideric: limit in ms-sql

Beitrag lesen

Ich habe endlich auch das blättern wieder, wie im limit auf my-sql um die seite nach einer gewissen anzahl um zuschalten.

$mysql = "SELECT \* FROM flug WHERE user LIKE '$username' AND destination1 = '$destination' OR user LIKE '$username' AND destination2 = '$destination' OR user LIKE '$username' AND destination3 = '$destination' OR user LIKE '$username' AND destination4 = '$destination' OR user LIKE '$username' AND destination5 = '$destination' ORDER BY '$order' $sort LIMIT $Anfangsposition,$Zeilen\_pro\_Seite";  

$result=mysql_query($mysql);

\*/  
  
$sql = "SELECT TOP $Zeilen\_pro\_Seite max(id) as id, ACODE, max(gruppiert) as gruppiert, max(sprache) as sprache,  

max(airport_ab) as airport_ab, max(airline) as airline, max(userfirma) as userfirma, max(destination1) as destination1,
  max(reiseart1) as reiseart1, max(name1) as name1, max(angebotvon) as angebotvon, max(angebotbis) as angebotbis, max(currency1) as currency1,
  max(preis1) as preis1, max(preis1beschreibung) as preis1beschreibung, max(abpreis1) as abpreis1, max(dauer) as dauer,
  max(aktiv) as aktiv, max([user]) as [user], max(tabelle) as tabelle
  FROM flug WHERE
  [user] LIKE '$username'
  AND '$destination' IN (destination1, destination2, destination3, destination4, destination5)
  AND ACODE NOT IN (SELECT TOP $Anfangsposition ACODE FROM flug WHERE [user] LIKE '$username' AND '$destination' IN (destination1,
  destination2, destination3, destination4, destination5) GROUP BY ACODE ORDER BY max($order) $sort)
  GROUP BY ACODE ORDER BY max($order) $sort";
  $result=mssql_query($sql);

$result1=mssql_query("SELECT distinct(ACODE) FROM flug WHERE user LIKE '$username' AND destination1 = '$destination' OR user LIKE '$username' AND destination2 = '$destination' OR user LIKE '$username' AND destination3 = '$destination' OR user LIKE '$username' AND destination4 = '$destination' OR user LIKE '$username' AND destination5 = '$destination' ");
$Anzahl=mssql_num_rows($result1);

Ich hoffe es hilft euch auch