Master details with TQuery

Hi,
How can I do a master detail
relationship between two tquerys ?
Thanks.
LVL 4
jeurkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.