0

SQL の結果を特定の「ポイント システム」で並べ替えようとしています。入力されたフィールドごとに、検索結果に一定のポイントが付与されます。SQL の最後に次の ORDER BY コードを追加しますが、「1」の数字の 1 つをより大きな数字に変更しても、検索結果の順序は変更されません。なぜそれがうまくいかないのですか?(この例では、bedrijfslogo-case を 9 に変更しました):

みんなありがとう!

$sql .= " ORDER BY

case when ID is not null then 1 else 0 end +
case when username is not null then 1 else 0 end +
case when password is not null then 1 else 0 end +
case when voornaam is not null then 1 else 0 end +
case when achternaam is not null then 1 else 0 end +
case when telefoonnummerP is not null then 1 else 0 end +
case when emailP is not null then 1 else 0 end +
case when functie is not null then 1 else 0 end +
case when bedrijfsnaam is not null then 1 else 0 end +
case when bedrijfsslogan is not null then 1 else 0 end +
case when bedrijfslogo is not null then 9 else 0 end +
case when bedrijfsfoto is not null then 1 else 0 end +
case when bedrijfsfoto2 is not null then 1 else 0 end +
case when bedrijfsfoto3 is not null then 1 else 0 end +
case when bedrijfsfoto4 is not null then 1 else 0 end +
case when bedrijfsomschrijving is not null then 1 else 0 end +
case when bedrijfsspecialiteiten is not null then 1 else 0 end +
case when bedrijfsgeschiedenis is not null then 1 else 0 end +
case when openingstijden is not null then 1 else 0 end +
case when kvk is not null then 1 else 0 end + 
case when straatnaam is not null then 1 else 0 end + 
case when huisnummer is not null then 1 else 0 end + 
case when postcode is not null then 1 else 0 end + 
case when plaats is not null then 1 else 0 end + 
case when nevenvestigingen is not null then 1 else 0 end + 
case when telefoonnummer is not null then 1 else 0 end + 
case when fax is not null then 1 else 0 end + 
case when email is not null then 1 else 0 end + 
case when website is not null then 1 else 0 end + 
case when twitter is not null then 1 else 0 end + 
case when facebook is not null then 1 else 0 end + 
case when youtube is not null then 1 else 0 end + 
case when linkedin is not null then 1 else 0 end + 
case when hoofdrubriek is not null then 1 else 0 end + 
case when subrubrieken is not null then 1 else 0 end + 
case when merken is not null then 1 else 0 end +
case when diensten is not null then 1 else 0 end +
case when productsoorten is not null then 1 else 0 end +
case when brancheverenigingen is not null then 1 else 0 end

 DESC"; 
4

1 に答える 1