That Guy
Meubilair
- Lid geworden
- 28 nov 2006
- Berichten
- 5.010
Yo,
ik heb twee tabellen, 'posts' en 'threads'.
posts
id (int)
time (int) (UNIX stamp)
thread (int) (ID van thread in tabel 'threads')
threads
id (int)
sticky (int) (0 of 1)
name (text) (naam thread)
topic (int) (gaat t ff niet om)
ik probeer deze query:
maar dit wil helaas niet werken (kan zoiets zowiezo?). Iemand een idee hoe ik de threads zo kan orderen, dat eerst op sticky threads wordt geordend, en daarna op de tijd?
:thumb:
ik heb twee tabellen, 'posts' en 'threads'.
id (int)
time (int) (UNIX stamp)
thread (int) (ID van thread in tabel 'threads')
id (int)
sticky (int) (0 of 1)
name (text) (naam thread)
topic (int) (gaat t ff niet om)
ik probeer deze query:
PHP:
$id = 42; //gaat t even niet om
$q = mysql_query("
SELECT DISTINCT threads.id, threads.name
FROM threads, posts
WHERE threads.topic='". $id ."'
ORDER BY threads.sticky DESC, posts.time DESC
");
maar dit wil helaas niet werken (kan zoiets zowiezo?). Iemand een idee hoe ik de threads zo kan orderen, dat eerst op sticky threads wordt geordend, en daarna op de tijd?
:thumb:
Laatst bewerkt: