There is a table (ROOM):
?
Bedroom number char ?? 4?
Name? Nchar? 4?
?
Now ask a SQL statement to make the collections after queries are:
-------------------------------------------------- -----------------------
Bedroom number? Member one? Member two? Member three? Member four? Member five? Member six? Member seven? Member eight
-------------------------------------------------- -----------------------
solution:
SELECT bedroom number
?????, member one = max (Case ID when 1 Then Name End)
?????, member two = max (Case ID when 2 Then Name End)
?????, member three = max (Case ID when 3 Then Name End)
?????, member four = max (Case ID when Name End)
?????, member five = max (Case ID WHEN 5 THEN Name END)
?????, member six = max (Case ID WHEN 6 THEN Name END)
?????, member seven = max (Case ID when 7 Then Name End)
?????, member eight = max (Case ID when 8 Then Name End)
FROM
????? SELECT bedroom number, name, ID = (
?????????? select count (*) from room
?????????? WHERE bed room number = a. bedroom number
????????????????id name <= a. Name)
????? from room a
) a group by bedroom number
?