Hello everyone, I have a question about Group by statement. I have two tables in my database:
Genre: Horror, Romance, Commedy,
Film: film1, film2, film3,film4,film5,film6
In Film table, I have a foreign key which is connected to the primary key of Genre Table. Here is my question:
I want to get all films and goup them by Genre and display in a datalist, what should the query be?
The result I want is something like:
Commedy: film5, film6
Horror: film1, film 2
Romance: film3, film4
Use the following query:
Select genre,film
from Genre
inner join film on film.genrID=genre.genreID
order by genre,film ASC
I get this result:
Horror: film1
Horro: film2
Romance: film3...
...
Here is my datalist:
<asp:DataList ID="datalist1" runat="server" DataKeyField="genreID"
RepeatColumns= ...
Go to the complete details ...