Autor Beitrag
Müscha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: So 16.04.06 20:28 
Hi Leute,

Ich habe eine Access-Datenbank mittels Query , also SQL eingebunden, nun möchte ich nur die ersten 10 angezeigt bekommen, ich habe 2 Versuche die nicht hinhauen:

ausblenden SQL-Anweisung
1:
SELECT top (10) * FROM `Highscore` ORDER BY (Punktzahl) desc					


und

ausblenden SQL-Anweisung
1:
SELECT * FROM `Highscore` ORDER BY (Punktzahl) desc limit 0,10					


das geht aber glaub ich nur mit MySql was ich glaube ich nicht mache!


Aber das erste müssste doch funktionieren oder?

M Ü S C H A

Moderiert von user profile iconKlabautermann: Code- durch SQL-Tags ersetzt & Query umschließende ' entfernt.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 16.04.06 20:42 
Wenn ich Access richtig im Kopf hab ohne ´´ und Runde Klammern sind auch was ganz anderes. Wenn Du felder escapen willst, dann mit []; in deinem Fall geht's aber ohne ...

ausblenden SQL-Anweisung
1:
SELECT * FROM Highscore ORDER BY Punktzahl DESC LIMIT 010					

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: So 16.04.06 20:46 
das kanns nicht sein, diese ` ` müssen schon bleiben

denn das funktionirt ja:

ausblenden SQL-Anweisung
1:
SELECT * FROM `Highscore´ ORDER BY Punktzahl DESC					


Moderiert von user profile iconKlabautermann: Code- durch SQL-Tags ersetzt
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 16.04.06 21:25 
Was gibt Access denn für ne genaue Meldung aus?

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Stego
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 35

WIN XP
Delphi 2005 Archi.
BeitragVerfasst: So 16.04.06 21:59 
moin, versuch mal
ausblenden SQL-Anweisung
1:
2:
3:
SELECT TOP 10 * 
FROM Highscore 
ORDER BY Punktzahl DESC;


Gruß Stephan
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: So 16.04.06 22:07 
Danke erstmal für die antworten.
also da meldets jetzt keinen Fehler, aber es passiert auch nix, es werden immernoch alle angezeigt bei dem hier:


ausblenden SQL-Anweisung
1:
SELECT Top 10 * FROM Highscore ORDER BY (Punktzahl) desc					


Moderiert von user profile iconKlabautermann: Code- durch SQL-Tags ersetzt
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 16.04.06 22:09 
Die `` sind übrigens nicht nötig.
ausblenden SQL-Anweisung
1:
SELECT * FROM Highscore ORDER BY Punktzahl DESC LIMIT 10;					

Das hier funktioniert auf Jedenfall.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: So 16.04.06 22:14 
bei mir funktioniert das nicht!

Da zeigts nen Fehler an:

allg. SQL-Fehler
Syntaxfehler in der ORDER BY - Klausel
Stego
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 35

WIN XP
Delphi 2005 Archi.
BeitragVerfasst: So 16.04.06 23:04 
also das von GTA-Place
SELECT * FROM Highscore ORDER BY Punktzahl DESC LIMIT 10;
funzt bei mir auch nicht.
Ich meine auch das man LIMIT anders einsetzt, nur finde ich Momentan nichts dazu.
Mich wundert nur warum der Vorschlag von mir nicht das richtige Ergebnis liefert, müsste eigtlich klappen.

Darf ich mal fragen, versuchts du in Access diese Befehle oder versuchst du mittels Delphi o.Ä. auf die Access-Datenbank zuzugreifen :?:
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Mo 17.04.06 00:08 
user profile iconBenBE hat folgendes geschrieben:
Wenn ich Access richtig im Kopf hab ohne ´´ und Runde Klammern sind auch was ganz anderes. Wenn Du felder escapen willst, dann mit []; in deinem Fall geht's aber ohne ...

ausblenden SQL-Anweisung
1:
SELECT * FROM Highscore ORDER BY Punktzahl DESC LIMIT 010					


Probiere es mal sorum :

ausblenden SQL-Anweisung
1:
SELECT * FROM `Highscore` ORDER BY Punktzahl DESC LIMIT 010;					
Stego
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 35

WIN XP
Delphi 2005 Archi.
BeitragVerfasst: Mo 17.04.06 01:05 
Ob nun mit ' ' oder " " oder komplett ohne ist bei Access letztendlich egal. Eigtlich wird alles davon akzeptiert.
Undwie schonmal gesagt mit euren Limit das funzt nicht, nehmt doch mal das DESC weg und versucht es dann, vielleicht seht ihr das dann mal, das gibt ne Fehlermeldung!
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mo 17.04.06 08:07 
Ach um Access geht's. Da weiß ich es nicht. In MySQL geht das aufjedenfall, sonst würde meine Shoutbox nicht funktionieren.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Mo 17.04.06 18:30 
mhhhh das haut alles nich

hat noch jemand ne andere idee wie ich ich das machen könnte, ohne "order by" oder "Limit"?

vielleicht in ein richedit oder so die ersten 10 ausgeben? der noch ne ganz andere möglichkeit?
MarkusB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: Di 18.04.06 07:59 
Moin Müscha!

Folgendes:

user profile iconStego hat folgendes geschrieben:
moin, versuch mal
ausblenden SQL-Anweisung
1:
2:
3:
SELECT TOP 10 * 
FROM Highscore 
ORDER BY Punktzahl DESC;


Gruß Stephan


ist absolut richtig.

Viele Grüße
Markus
:gruebel:
Stego
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 35

WIN XP
Delphi 2005 Archi.
BeitragVerfasst: Di 18.04.06 15:12 
Wäre es vielleicht möglich das du mal deine Datenbank ohne Inhalt oder so hochlädst und man dann vielleicht gucken könnte ob du vielleicht falsche Typen hast oder Ähnliches. Vielleicht finden wir ne Lösung ;-)

Gruß Stephan
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Di 18.04.06 15:38 
also ich dachte ja vielleicht wegen MYSQL weil ich das glaub ich nicht benutze und die Befehle nur in MySQL funktionieren???

naja, hier ist erstmal die datenbank, mit werten, ist ja nix wichtiges drin :)
Einloggen, um Attachments anzusehen!
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Di 18.04.06 15:40 
also nur zur information, vielleicht isses ja sinnvoll zu sagen


ich hab die DB mit

einem query
einem Datasource
und einem Database

eingebunden!
Stego
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 35

WIN XP
Delphi 2005 Archi.
BeitragVerfasst: Di 18.04.06 20:56 
also ich weiß nicht warum ich das hier mal gefragt hatte:
user profile iconStego hat folgendes geschrieben:
Darf ich mal fragen, versuchts du in Access diese Befehle oder versuchst du mittels Delphi o.Ä. auf die Access-Datenbank zuzugreifen ?


würde vielleicht nun endlich mal KLarheit schaffen...
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Mi 19.04.06 09:30 
sorry hab ich voll überlesen :autsch:

naja also ich habe ein access Datenbank die ich in delphi ausgebe!

Also ich versuche mittels Delphi auf die Access-datenbank zuzugreifen...