我有一个查找(或链接)表learning_event_presentation_lookup
:
+---------------------------------------+-------------------+-----------------+
| learning_event_presentation_lookup_pk | learning_event_fk | presentation_fk |
+---------------------------------------+-------------------+-----------------+
这是为了方便连接表learning_event
和presentation
。
我需要在以下代码的联接中使用该表。
当前出现错误:
DataTables警告:表id = learning_event_table-发生SQL错误:SQLSTATE [42000]:语法错误或访问冲突:1066不是唯一的表/别名:“ learning_event”
$( '#learning_event_table' ).DataTable( {
ajax: "program_data/learning_event_data.php",
dom: "Bfrtip",
columns: [ {
data: "learning_event.learning_event_name"
}, {
data: "learning_event.learning_event_outcome"
}, {
data: "rdb_group.rdb_group_name"
}, {
data: "presentation.presentation_name"
}, {
data: "rotation_discipline_block.rotation_discipline_block_name"
} ],
select: {
style: 'os',
selector: 'td:first-child'
},
buttons: [ {
extend: "create",
editor: editor
}, {
extend: "edit",
editor: editor
}, {
extend: "remove",
editor: editor
} ]
} );
和
Editor::inst( $db2, 'learning_event', 'learning_event_pk' )
->field(
Field::inst( 'learning_event.learning_event_name' ),
Field::inst( 'learning_event.learning_event_outcome' ),
Field::inst( 'presentation.presentation_name' ),
Field::inst( 'learning_event.rdb_group_fk' )
->options( Options::inst()
->table( 'rdb_group' )
->value( 'rdb_group_pk' )
->label( 'rdb_group_name' )
)
->validator( 'Validate::notEmpty' ),
Field::inst( 'rdb_group.rdb_group_name' ),
Field::inst( 'learning_event.rotation_discipline_block_fk' )
->options( Options::inst()
->table( 'rotation_discipline_block' )
->value( 'rotation_discipline_block_pk' )
->label( 'rotation_discipline_block_name' )
)
->validator( 'Validate::dbValues' ),
Field::inst( 'rotation_discipline_block.rotation_discipline_block_name' )
)
->leftJoin( 'rdb_group', 'rdb_group.rdb_group_pk', '=', 'learning_event.rdb_group_fk' )
->leftJoin( 'rotation_discipline_block', 'rotation_discipline_block.rotation_discipline_block_pk', '=', 'learning_event.rotation_discipline_block_fk' )
->leftJoin( 'presentation', 'presentation.presentation_pk', '=', 'learning_event_presentation_lookup.presentation_fk' )
->leftJoin( 'learning_event', 'learning_event.learning_event_pk', '=', 'learning_event_presentation_lookup.learning_event_fk' )
->process($_POST)
->json();
答案 0 :(得分:0)
好的,我在以下位置查看了使用链接表的文档:
https://editor.datatables.net/examples/advanced/joinLinkTable.html
所以现在我有以下内容,它们不会产生任何错误并且不能正常工作。不过,以dataTables格式进行联接不是很直观...
a = [lambda x:x * 2, lambda x: x-1]
b = [1, 2, 3, 4]
for func in a:
# apply each function on b and turn the results to list:
print(list(map(func, b)))