You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fields: ['test_table_id','GROUP_CONCAT(attribute) AS attributes'],
459
+
groupBy: 'test_table_id',
460
+
},
461
+
on: 'testTable.id = otherTableGrouped.test_table_id',
462
+
alias: 'otherTableGrouped',
463
+
},
464
+
})
465
+
466
+
expect(query).toEqual(
467
+
'SELECT * FROM testTable JOIN (SELECT test_table_id, GROUP_CONCAT(attribute) AS attributes FROM otherTable GROUP BY test_table_id) AS otherTableGrouped ON testTable.id = otherTableGrouped.test_table_id WHERE field = ?1'
468
+
)
469
+
})
470
+
471
+
test('select with nested subquery joins',async()=>{
472
+
constquery=newQuerybuilderTest()._select({
473
+
tableName: 'testTable',
474
+
fields: '*',
475
+
where: {
476
+
conditions: 'field = ?1',
477
+
params: ['test'],
478
+
},
479
+
join: {
480
+
table: {
481
+
tableName: 'otherTable',
482
+
fields: [
483
+
'test_table_id',
484
+
'GROUP_CONCAT(attribute) AS attributes',
485
+
'GROUP_CONCAT(other_attributes, ";") AS other_attributes',
486
+
],
487
+
groupBy: 'test_table_id',
488
+
join: {
489
+
table: {
490
+
tableName: 'otherTableTwo',
491
+
fields: ['other_table_id','GROUP_CONCAT(other_attribute) AS other_attributes'],
492
+
groupBy: 'other_table_id',
493
+
},
494
+
on: 'otherTable.id = otherTableTwoGrouped.other_table_id',
495
+
alias: 'otherTableTwoGrouped',
496
+
},
497
+
},
498
+
on: 'testTable.id = otherTableGrouped.test_table_id',
499
+
alias: 'otherTableGrouped',
500
+
},
501
+
})
502
+
503
+
expect(query).toEqual(
504
+
'SELECT * FROM testTable JOIN (SELECT test_table_id, GROUP_CONCAT(attribute) AS attributes, GROUP_CONCAT(other_attributes, ";") AS other_attributes FROM otherTable JOIN (SELECT other_table_id, GROUP_CONCAT(other_attribute) AS other_attributes FROM otherTableTwo GROUP BY other_table_id) AS otherTableTwoGrouped ON otherTable.id = otherTableTwoGrouped.other_table_id GROUP BY test_table_id) AS otherTableGrouped ON testTable.id = otherTableGrouped.test_table_id WHERE field = ?1'
505
+
)
506
+
})
507
+
447
508
test('select with one where no parameters',async()=>{
0 commit comments