Last active
December 9, 2015 22:48
-
-
Save s0ren/4339556 to your computer and use it in GitHub Desktop.
Praktik 1 guldkorn i asp.net/mssql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Udvælg 8 tilfældige billeder til forsiden af galleriet | |
cmd.CommandText = "SELECT TOP 8 * FROM billede ORDER BY NEWID()"; | |
// Udvælg alle kategorier sammen med antallet af biller i hver kategori | |
cmd.CommandText = "SELECT kategori.id, kategori.navn, Count(billede.id) as billeder " | |
+ "FROM billede INNER JOIN kategori " | |
+ " ON billeder.FK_kategori_id = kategori.id " | |
+ "GROUP BY kategori.id, kategori.navn"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment