Home DADE
New Blog Posts: Merging Reports - Part 1 and Part 2

Problems with ordering and master detail relation

edited June 2003 in DADE
Hi,

is there any problems regarding ordering and setting master detail relation
between two queries? The problem is in one report with followin data
structure:

Master query and one detail query. If I set anything in the order by sql
part in the master query then the detail query is always empty.

Master query is:
*****************************
SELECT sznUcastniku.ID,
sznUcastniku.PoradoveCislo,
sznUcastniku.TridniKnihaID,
sznUcastniku.CustomPorCislo,
tblSznPrac.RodneCislo,
tblSznPrac.Prijmeni, tblSznPrac.Jmeno,
tblSznFirem.Nazev, tblSznFirem.Ulice,
tblSznFirem.Mesto
FROM sznUcastniku sznUcastniku
INNER JOIN sznPrihlOsoby sznPrihlOsoby ON
(sznPrihlOsoby.ID = sznUcastniku.PrihlOsobyID)
INNER JOIN tblSznPrac tblSznPrac ON
(tblSznPrac.ID = sznPrihlOsoby.PracovnikID)
LEFT OUTER JOIN tblSznFirem tblSznFirem ON
(tblSznFirem.ID = tblSznPrac.ZamestnavatelID)

Detail query is:
***********************
SELECT sznKUcastnika.ID,
sznKUcastnika.CelkoveHodnoceni,
sznKUcastnika.Kurz,
sznKUcastnika.Platnost,
sznKUcastnika.PoradoveCislo,
sznKUcastnika.SznUcastnikuID,
sznKUcastnika.KurzID,
sznKUcastnika.KGroupID
FROM sznKUcastnika sznKUcastnika

With this queries the detail query will be printed correctly. If I change
master query to:

Modified master query:
*************************
SELECT sznUcastniku.ID,
sznUcastniku.PoradoveCislo,
sznUcastniku.TridniKnihaID,
sznUcastniku.CustomPorCislo,
tblSznPrac.RodneCislo,
tblSznPrac.Prijmeni, tblSznPrac.Jmeno,
tblSznFirem.Nazev, tblSznFirem.Ulice,
tblSznFirem.Mesto
FROM sznUcastniku sznUcastniku
INNER JOIN sznPrihlOsoby sznPrihlOsoby ON
(sznPrihlOsoby.ID = sznUcastniku.PrihlOsobyID)
INNER JOIN tblSznPrac tblSznPrac ON
(tblSznPrac.ID = sznPrihlOsoby.PracovnikID)
LEFT OUTER JOIN tblSznFirem tblSznFirem ON
(tblSznFirem.ID = tblSznPrac.ZamestnavatelID)
ORDER BY sznUcastniku.PoradoveCislo <------- Added

the detail query is always empty. Why? The relation between queries is
DetailQuery.SznUcastnikuID -> MasterQuery.ID


The report is easy. In the detail band of main report is one subreport. Main
report get data from main query and subreport gets data from Detail query.

Thank for your help.

Petr Slipek

Comments

This discussion has been closed.