qSelectEventUsers – 1st query
Note: we use UsersID, eventsID as field alias
1 2 3 4 5 6 7 8 9 |
SELECT distinct(u.id) as usersID, /* <<<<*/ u.name, u.family, u.patronymic, (select concat(u.family,' ',LEFT(u.name, 1),'.',LEFT(u.patronymic, 1) ) ) as usersShortName, uheht.events_id as eventsID /* <<<<*/ FROM coffeetest_db.users_has_events_has_tests uheht, users u where uheht.users_id=u.id and uheht.events_id=:events_id |
setup DataSource
1 |
DS_EventUsers.DataSet:=qSelectEventUsers |
qSelectEventUsersElements – 2d query
Note: we use UsersID, eventsID as param
1 2 3 |
SELECT t.name as testsName,s.name as statusName, uheht.users_id as usersID FROM coffeetest_db.users_has_events_has_tests uheht, status s, tests t where uheht.status_id=s.id and uheht.tests_id=t.id and events_id=:eventsID and uheht.users_id=:usersID order by t.name |
setup 2-d query
1 2 3 |
qSelectEventUsersElements.MasterSource:=DS_EventUsers qSelectEventUsersElements.MasterFields:=[UsersID;eventsID] |
setup FastReport components
frxDBDataset_qSelectEventUsers
DataSet:=DS_EventUsers
UserName:=frxDBDataset_qSelectEventUsers
frxDBDataset_qEventUserElements
DataSet:=qSelectEventUsersElements
UserName:=frxDBDataset_qEventUserElements
In frxReport enable DataSets and use fields…