Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
u9_databaser [2013-01-24 15:20]
Joakim Forsgren
u9_databaser [2017-09-01 14:54] (current)
Line 131: Line 131:
 */ */
 </​php>​ </​php>​
 +
 +=== Sista frågan från genomgång ===
 +
 +<code SQL>
 +SELECT *, COUNT(ChangeDate) as N, EMail as ThreadEMail FROM (
 +SELECT lab5_Threads.*,​ ItemID, ChangeDate, EMail as ItemEMail FROM lab5_Users ​
 +INNER JOIN  `lab5_Threads` USING(UserID)
 +LEFT JOIN lab5_Items ​
 +USING (ThreadID)
 +ORDER BY ChangeDate DESC) as t1
 +INNER JOIN lab5_Users USING(UserID)
 +GROUP BY ThreadID
 +ORDER BY ChangeDate DESC
 +
 +</​code>​