This topic is locked
[SOLVED]

 Help with SQL Query nested loops

12/22/2020 10:13:51 AM
PHPRunner General questions
I
Ivan van Oosterhout author

Hi,
I need some help with an SQL Query, Nested Loop? I do not know the approach.

Can somebody point me in the correct direction please?
i have 1 Table Orders, this is how it looks like:
Row JobKey Counter OrderNumber

442 1 1 30

448 1 2 30

449 1 3 30

450 1 4 30

451 1 5 30

452 1 6 30

453 1 7 30

454 1 8 30

455 1 9 30

456 1 10 30

457 2 1 30

458 2 2 30

461 2 3 30

462 2 4 30

463 2 5 30

464 2 6 30

465 2 7 30

466 2 8 30

467 2 9 30

468 2 10 30
What i want to accomplish is this:
$data = $button->getCurrentRecord(); = 30 Ordernumber
$value["JobKey"] = 1 (Group By?)
$value[counter] = 1 (row 442)

$value[counter] = 2

$value[counter] = 3

$value[counter] = 4

$value[counter] = 5

$value[counter] = 6

$value[counter] = 7

$value[counter] = 8

$value[counter] = 9

$value[counter] = 10
$value["JobKey"] = 2
$value[counter] = 1 (row 457)

$value[counter] = 2

$value[counter] = 3

$value[counter] = 4

$value[counter] = 5

$value[counter] = 6

$value[counter] = 7

$value[counter] = 8

$value[counter] = 9

$value[counter] = 10
And continuering if i have more.