Einzelnen Beitrag anzeigen

omata

Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
 
Delphi 7 Enterprise
 
#27

Re: MySQl-Query läuft "ewig"

  Alt 12. Jul 2008, 21:44
Neuer Versuch...
SQL-Code:
SELECT timestamp AS time,
       new_owner AS new_owner_id
FROM de12_conquer
WHERE (timestamp > 0 && timestamp < 1213647029734)
  AND ( new_owner IN (SELECT id
                        FROM de12_tribe
                        WHERE ally = 37038)
       OR old_owner IN (SELECT id
                        FROM de12_tribe
                        WHERE ally = 37038))
ORDER BY timestamp DESC LIMIT 50
oder so...
SQL-Code:
SELECT timestamp AS time,
       new_owner AS new_owner_id
FROM de12_conquer c
WHERE (timestamp > 0 && timestamp < 1213647029734)
  AND EXISTS (SELECT *
              FROM de12_tribe
              WHERE ally = 37038
                AND ( id = c.new_owner
                     OR id = c.old_owner))
ORDER BY timestamp DESC LIMIT 50
Wieviel Zeilen ergibt das Folgende überhaupt?
SQL-Code:
SELECT id
FROM de12_tribe
WHERE ally = 37038
Geht es schneller ohne den timestamp und die Sortierung?
  Mit Zitat antworten Zitat