Maarten Docter
Maarten Docter

Reputation: 1029

FileMaker - How to query multiple database files via ODBC

When I use ODBC to query a FileMaker 11 server, it looks like my query is restricted to retrieve data from one database at a time.

I want to query for data in one database, but only return records that have some related data in another database (on the same FileMaker server). I know how to write normal JOINs, but I don't know how to do this across multiple databases.

Is this even possible? If so, can you please provide a small SQL Query example or code snippet (preferably in C#)?

Upvotes: 0

Views: 773

Answers (2)

Nicolai Kant
Nicolai Kant

Reputation: 1391

FileMaker ODBC queries, same as ExecuteSQL (FQL) statements are based on a Table Occurrence placed in the relationships graph of "Manage Database".

To use a table from another FileMaker file (database, DSN) in a query, add this file to the "External Data Sources" of the target file and place the Table Occurrence of the table you need to query into "Manage Database" of the target file.

This was just a guess initially, but was kindly confirmed by @Maarten Docter.

Upvotes: 1

Nick Otten
Nick Otten

Reputation: 712

I don't know filemaker but if it accepts plain SQL you can join data across databases (given that they run on the same database server). Just refer the full path to your columns. For example if you want to join serial numbers of database A B and C:

    SELECT * 
    FROM DatabaseA.dbo.MainDb
    INNER JOIN DatabaseB.dbo.SubDb ON DatabaseA.dbo.MainDb.Serialnumber = DatabaseB.dbo.SubDb.Serialnumber
    INNER JOIN DatabaseC.dbo.Other ON DatabaseA.dbo.MainDb.Serialnumber = DatabaseC.dbo.Other.Serialnumber

note that if you want a specific set of columns, you have to write the full path of said column (same way as shown in the join)

Upvotes: 0

Related Questions