• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

Master details with TQuery

Hi,
How can I do a master detail
relationship between two tquerys ?
Thanks.
0
jeurk
Asked:
jeurk
  • 3
  • 3
  • 2
1 Solution
 
LischkeCommented:
Hi jeurk,

try using TQuery.DataSource. This will execute the query in TQuery (if it is a SELECT statement) each time the record pointer in the DataSource changes. This means the dataset in DataSource is the master in this scenario.

Ciao, Mike
0
 
kretzschmarCommented:
yup, mike is right,
but a bit more explaination from me

for example
query1 is your master and holds the sql-statement

select id, afield, bfield from mastertablename [where somecondition [order by some field(s) [desc]]]

[]-means optional

query2 is your detail and holds the sql-statement

select id, afield, bfield from detailtablename where mid = :id
[and somecondition [order by some field(s) [desc]]]

mid means the field which pointed to the master-id
[]-means optional

now drop two datasources
connect each with one query
adjust the query2-property datasource to the datasource, which is connected to query1

id and (:)id should have the name of your id-name

well, start your app and try
if there problems, just tell

meikl
0
 
kretzschmarCommented:
hello ?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
jeurkAuthor Commented:
Hello,

I can see that that stupid new
system has not taken in account my
comments. I was waiting a reaction to it.
I sayd that I liked your question best
but Mike gave the answer first but
much less detailed. So I was embarrassed
to how to give the points out.

A comment ?
CU
0
 
LischkeCommented:
If the details are important for you then give Meikl the points.

Ciao, Mike
0
 
kretzschmarCommented:
hi jeurk,

i'm attempt to say,
'yes gimme the points, barry(inthe) is in my neck',
but what is about sharing the points between me and mike.

just ask for this in the customer-support of ex-ex

meikl ;-)
0
 
jeurkAuthor Commented:
Ok, here are the points.
I'll ask a new quastion for you Lischke.

Thanks guys
0
 
LischkeCommented:
Oh, thanks :-)

Ciao, Mike
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now