I got three tables:
-----------------------------------
tbl_depart
primary key: DEPART_ID
name
-----------------------------------
tbl_depart_weekday
primary key: DEPART_WEEKDAY_ID
foreign key: DEPART_ID
foreign key: WEEKDAY_ID
-----------------------------------
tbl_weekday
primary key: WEEKDAY_ID
weekdayName
-----------------------------------
I want to make a SELECT statement that returns this data when it runs:
DEPART_ID | name | monday | tuesday | wednesday | thursday | friday
-------------------------------------------------------------------
1 | dep1 | 0 | 1 | 1 | 0 | 1
The value 0 or 1 for monday-friday represent if the there is a post in 'tbl_depart_weekday' with 'DEPART_ID=1' and 'WEEKDAY_ID=1,2,3..' for this row
I hope you understand my question..
Thanks a lot!
-ismar-
-----------------------------------
tbl_depart
primary key: DEPART_ID
name
-----------------------------------
tbl_depart_weekday
primary key: DEPART_WEEKDAY_ID
foreign key: DEPART_ID
foreign key: WEEKDAY_ID
-----------------------------------
tbl_weekday
primary key: WEEKDAY_ID
weekdayName
-----------------------------------
I want to make a SELECT statement that returns this data when it runs:
DEPART_ID | name | monday | tuesday | wednesday | thursday | friday
-------------------------------------------------------------------
1 | dep1 | 0 | 1 | 1 | 0 | 1
The value 0 or 1 for monday-friday represent if the there is a post in 'tbl_depart_weekday' with 'DEPART_ID=1' and 'WEEKDAY_ID=1,2,3..' for this row
I hope you understand my question..
Thanks a lot!
-ismar-