Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

SQL Server CE - TOP ou LIMIT

1 réponse
Avatar
Bonjour,

J'ai une requête :
req = "Select * From ProjetsRécents Order By
Date_dernière_modification_projet Desc"

qui me retourne 5 enregistrements (sans erreur)

De plus, j'ai 1 variable Nombre_Projets_récents qui vaut actuellement 3.

J'aimerais qu'elle ne me retourne qu'un certain nombre d'enregistrements,
j'ai essayé toutes ces syntaxes qui me retourne à chaque fois 1 erreur :
req = "Select Top " & Nombre_Projets_récents & " * From ProjetsRécents Order
By Date_dernière_modification_projet Desc"

req = "Select * From ProjetsRécents Order By
Date_dernière_modification_projet Desc Top " & Nombre_Projets_récents

req = "Select * From ProjetsRécents Order By
Date_dernière_modification_projet Desc Limit " & Nombre_Projets_récents

req = "Select * From ProjetsRécents Order By
Date_dernière_modification_projet Desc Limit 0, " & Nombre_Projets_récents

req = "Select * From ProjetsRécents Order By
Date_dernière_modification_projet Desc Limit 1, " & Nombre_Projets_récents

Quelle est la bonne syntaxe qui permettrait de résoudre mon problème ?



Merci d'avance,

Stéphane

1 réponse

Avatar
Trouvé (pourtant j'avais cherché !) ! C'est fou desfois ces syntaxes !

req = "Select Top (" & Nombre_Projets_récents & ") * From ProjetsRécents
Order
By Date_dernière_modification_projet Desc"

Et pour info, Top (i) à la fin ne fonctionne pas non plus.

@+
Stéphane


<Stéphane> a écrit dans le message de news:

Bonjour,

J'ai une requête :
req = "Select * From ProjetsRécents Order By
Date_dernière_modification_projet Desc"

qui me retourne 5 enregistrements (sans erreur)

De plus, j'ai 1 variable Nombre_Projets_récents qui vaut actuellement 3.

J'aimerais qu'elle ne me retourne qu'un certain nombre d'enregistrements,
j'ai essayé toutes ces syntaxes qui me retourne à chaque fois 1 erreur :
req = "Select Top " & Nombre_Projets_récents & " * From ProjetsRécents
Order By Date_dernière_modification_projet Desc"

req = "Select * From ProjetsRécents Order By
Date_dernière_modification_projet Desc Top " & Nombre_Projets_récents

req = "Select * From ProjetsRécents Order By
Date_dernière_modification_projet Desc Limit " & Nombre_Projets_récents

req = "Select * From ProjetsRécents Order By
Date_dernière_modification_projet Desc Limit 0, " & Nombre_Projets_récents

req = "Select * From ProjetsRécents Order By
Date_dernière_modification_projet Desc Limit 1, " & Nombre_Projets_récents

Quelle est la bonne syntaxe qui permettrait de résoudre mon problème ?



Merci d'avance,

Stéphane