Solved

paradox query problem

Posted on 2008-10-22
6
265 Views
Last Modified: 2013-11-23
Hi
I am using Paradox tables.
Can somebody advise me on how to create a query in delphi using 2 tables
I have a header table and detail table ( 1 to N relationship)
The key field is Job_no which is unique in the header
I want to create a query which shows me all the records that have no header records in the details table
I what to avoid using a do while loop
Regards



0
Comment
Question by:SSSIAN
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 6

Expert Comment

by:FactorB
ID: 22779724
You need a JOIN query, that will bring together one to many relational tables

Select header.*,detail.* from header inner join detail on header.job_no = detail.job_no;
0
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 100 total points
ID: 22783237
no you need a left join, not an inner

select d.*
from detail d
  left join header h on h.job_no = d.job_no
order by d.job_no

this will show you all the records in detail without header
and order them

select d.job_no, count(*) as amount_no_header
from detail d
  left join header h on h.job_no = d.job_no
group by d.job_no
order by d.job_no

will show how many records for each job_no that have no header

to delete all records in detail without header:
delete from details
where not job_no in (select job_no from header)

to see all headers without details
select h.*
from header h
  left join details d on h.job_no = d.job_no
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22784254
didn't the solution work ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:SSSIAN
ID: 22784429
Sorry Geert_Gruwez:
I am new to this, I thought I accepted the solution and gave you the points
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22784468
if the solution works, you should give an A
if it only works half and you have to edit the code and do research give it a B
if it doesn't work at all give comments and let the experts handle the comments

if you are totally dissatified with the experts comments and all experts have commented
give it a C

or read the help section on Asking Questions and grading on the EE
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 22788518
did the solution work ?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month5 days, left to enroll

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question