I have this table structure for SheduleWorkers table:
CREATE TABLE SheduleWorkers
(
[Name] varchar(250),
[IdWorker] varchar(250),
[IdDepartment] int,
[IdDay] int,
[Day] varchar(250)
);
INSERT INTO SheduleWorkers ([Name], [IdWorker], [IdDepartment], [IdDay], [Day])
values
('Sam', '001', 5, 1, 'Monday'),
('Lucas', '002', 5, 2, 'Tuesday'),
('Maria', '003', 5, 1, 'Monday'),
('José', '004', 5, 3, 'Wednesday'),
('Julianne', '005', 5, 3, 'Wednesday'),
('Elisa', '006', 18, 1, 'Monday'),
('Gabriel', '007', 23, 5, 'Friday');
I need to display for each week day the names of workers in the department 5 that works in this day, like this:
MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY
------ ------- --------- -------- ------ -------
Sam Lucas Jose
Maria Julianne
How can I get this result, I accept suggestions, thanks.