Solved

Quering problem

Posted on 2006-11-02
5
182 Views
Last Modified: 2010-04-05
I'm trying to query two dbf tables one that is there at my database with a program on foxpro 2.6 and the other is one that i created apart on excel, if i do something like this:

Table 1

1   jerry  programmer
2   Mary  analyst

Table 2

1  project1  
2  project2

i must be able to do this.

Select * from table1, table2 where table1.field1 = table2.field1

and get as result something like that

1   jerry  programmer   1 project1
2   Mary  analyst           2 project2


My problem seems to be that i created a file from a excel and save it as dbf file but when i try to do a query as simple as the one shown, it throws the messege error i configure it to throw.

By the way i'm using a Delphi interface i develope to query those tables and don't know the structure of the dbf files on foxpro. Basically i use the my app to query and get info that i need to know that the fox pro program does not give me.

How can i solve this? Any suggestions will be appreciated.

Thanks ahead!!
0
Comment
Question by:sisiliano
  • 2
5 Comments
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 17861842
Who will be processing the query "Select * from table1, table2 where table1.field1 = table2.field1". You have different DBs... My advice is do import these 2 tables in real DB and execute the query there.

If you want to do it your way, you will have to do it in loop organized by yourself. But it will be a problem to handle N:M relations...
0
 
LVL 1

Author Comment

by:sisiliano
ID: 17862722
And how may i do that, how to import both tables to a database, let say table1 is already in a database the one on foxpro, how do i import the other one i created on excel to these database or both to the same db, i guess i would not work just to copy paste it, would it?

Hope you could at least give a clue.

Thax so far Ivanov
0
 
LVL 12

Assisted Solution

by:Ivanov_G
Ivanov_G earned 50 total points
ID: 17862870
Almost every database have utilities for import/export. I have no experience with Paradox, so I can not answer you. Maybe there is something in the documentation.

The task can also be done using MS SQL Import and Export Wizard if you have it.

Otherwise you have to do that programatically. Open 2 connection from a test Delphi application and use "While not Table1.EOF" query for first database to insert in the second one.
0
 
LVL 6

Accepted Solution

by:
wimmeyvaert earned 50 total points
ID: 17864529
I guess you can Create an MS-Access db and import the dbf's into your access-db.

I gues there is a many-to^many relationship between Table1 and Table2, isn't it ?

If this is the case, then you should have a third table :
Person
   PersonID    Name
   1               jerry  programmer
   2               Mary  analyst

Project
   ProjectId     Name
   1                project1  
   2                project2

ProjPerson
   ID   PersonID    ProjectID
   1     1              1
   2     2              1
   3     1              2

Thne your query could look like :
SELECT p.Name AS [Person], Pr.Name AS [Project]
FROM T_Person p, T_Project pr, ProjPerson pp
WHERE p.PersonID = pp.PersonID
     AND pr.ProjectId = pp.ProjectID
ORDER BY p.Name, pr.Name

Output will look like
   Person                      Project
   ----------------------------------------
   jerry  programmer     Project1
   Mary  analyst             Project1
   jerry  programmer     Project2  


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

Suggested Solutions

Title # Comments Views Activity
Intraweb submit form as a POST request 4 304
Strange behavior when a form is closed 6 58
QRReport  TQrmemo vertical stretching 1 49
Dev express lookupcombo 3 30
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

825 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