It depends on the database you use.
You will need a subquery with line numbering.
SELECT "ID", ( SELECT COUNT( "ID" ) FROM "Table" WHERE "ID" <= "a"."ID" )
AS "Nr." FROM "Table" AS "a"
(See Base Guide, p. 385)
Line Numbering has to be grouped by the rows of you main table. If you have got more than one image for a row you have constructed a 1:n-relation between you maintable “tbl_main” and your imagetable “tbl_image”.
SELECT "Image",
( SELECT COUNT( "ID" ) FROM "tbl_image" WHERE "ID" <= "a"."ID" AND "maintableID" = "a"."maintableID") AS "Nr.",
"maintableID"
FROM "tbl_image" AS "a"
From this query you will get images for “Nr.”=1 and “Nr.”=2 in your “tbl_main”. For better understanding: I save the query and call in “qry_images”.
SELECT "a".*,
(SELECT "Image" FROM "qry_images WHERE "maintableID" = "a"."ID" AND "Nr." = 1) AS "Image1",
(SELECT "Image" FROM "qry_images WHERE "maintableID" = "a"."ID" AND "Nr." = 2) AS "Image2"
FROM "tbl_main" AS "a"
If the result is what you want try to get a view of it. Now you could add two image controls in the report to show 2 images at the right.