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 Both sides next revision
mysql_info [2009-10-15 12:36]
Joakim Forsgren
mysql_info [2009-10-15 12:36]
Joakim Forsgren
Line 4: Line 4:
 SELECT *,COUNT(ItemID) as Number FROM Threads LEFT JOIN Items USING(ThreadID) GROUP BY (ThreadID) SELECT *,COUNT(ItemID) as Number FROM Threads LEFT JOIN Items USING(ThreadID) GROUP BY (ThreadID)
  
-// För att ta bort, gör först en korrekt select+För att ta bort, gör först en korrekt select
 SELECT * FROM `lab5_Threads` RIGHT JOIN lab5_Items USING(ThreadID) WHERE Thread IS NULL SELECT * FROM `lab5_Threads` RIGHT JOIN lab5_Items USING(ThreadID) WHERE Thread IS NULL
-// sen ändrar man den till en delete+sen ändrar man den till en delete
 DELETE lab5_Items FROM `lab5_Threads` RIGHT JOIN lab5_Items USING(ThreadID) WHERE Thread IS NULL DELETE lab5_Items FROM `lab5_Threads` RIGHT JOIN lab5_Items USING(ThreadID) WHERE Thread IS NULL
 </code> </code>