Solved

Quering problem

Posted on 2006-11-02
5
185 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
[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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
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 …

691 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