web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

In PowerApps, how to connect to multiple tables in a VA SQL relational Database

(0) ShareShare
ReportReport
Posted on by
When using PowerApps, how do I find out how to connect and use multiple SQL tables on our VA SQL Server? After connecting to SQL Server and I have my tables, how to link to multiple tables and specific fields from each table connected? For clarity, the SQL side is understood. My question resides with PowerApps. Most examples I find just link to one table and columns within the single table. I want to create an Powerapp linking to multiple SQL tables, and then use one or many columns from each table.
Categories:
I have the same question (0)
  • Suggested answer
    MParikh Profile Picture
    290 Super User 2025 Season 2 on at
    Connecting to multiple tables in a VA SQL relational Database

    Here is a practical path you can follow. Try this approach and This is the example to start

    1. Connect• Use SQL Server Management Studio or Azure Data Studio.• Create a read-only login.• In SSMS, Connect, enter Server name, choose SQL Authentication or Windows, then Connect.
    2. Find the right tables and keysRun these to see columns and relationships.
     
     
     
    -- List tables
    SELECT s.name AS schema_name, t.name AS table_name
    FROM sys.tables t JOIN sys.schemas s ON s.schema_id = t.schema_id
    ORDER BY s.name, t.name;
    
    -- Columns for a table
    EXEC sys.sp_help 'dbo.Orders';
    
    -- Foreign keys in the database
    SELECT fk.name, OBJECT_NAME(fk.parent_object_id) AS child_table,
           cpa.name AS child_col, OBJECT_NAME(fk.referenced_object_id) AS parent_table,
           cref.name AS parent_col
    FROM sys.foreign_keys fk
    JOIN sys.foreign_key_columns fkc ON fkc.constraint_object_id = fk.object_id
    JOIN sys.columns cpa ON cpa.object_id = fkc.parent_object_id AND cpa.column_id = fkc.parent_column_id
    JOIN sys.columns cref ON cref.object_id = fkc.referenced_object_id AND cref.column_id = fkc.referenced_column_id
    ORDER BY child_table, fk.name;
    
    1. Link tables with JOINsPick the key fields from step 2. Then write targeted joins.
    Inner join, one to many: 
     
     
    SELECT o.OrderID, o.OrderDate, c.CustomerName
    FROM dbo.Orders o
    JOIN dbo.Customers c
      ON c.CustomerID = o.CustomerID
    WHERE o.OrderDate >= '2025-01-01';
    
    Left join to keep all rows from the left side:
      
    SELECT c.CustomerID, c.CustomerName, o.OrderID
    FROM dbo.Customers c
    LEFT JOIN dbo.Orders o
      ON o.CustomerID = c.CustomerID;
    
     
    Many to many through a bridge table:
     
     
    SELECT p.ProductID, p.ProductName, c.CategoryName
    FROM dbo.Products p
    JOIN dbo.ProductCategory pc
      ON pc.ProductID = p.ProductID
    JOIN dbo.Categories c
      ON c.CategoryID = pc.CategoryID;
    
     Composite key: 
     
     
    SELECT f.FactID, d.CalendarDate, d.FiscalYear
    FROM dbo.FactSales f
    JOIN dbo.DimDate d
      ON d.CalendarDate = f.CalendarDate
     AND d.FiscalYear  = f.FiscalYear;
    
    Across databases on the same server:
     
     
    SELECT *
    FROM SalesDB.dbo.Orders o
    JOIN MasterData.dbo.Customers c ON c.CustomerID = o.CustomerID;
    
    Across servers with a linked server:
    SELECT *
    FROM [LOCALSERVER].SalesDB.dbo.Orders o
    JOIN [LINKEDSRV].MasterData.dbo.Customers c ON c.CustomerID = o.CustomerID;
    
    1. Pull only what you need• List columns, avoid SELECT *.• Filter early with WHERE.• Use table aliases.• Always schema-qualify names.
    2. Check performance• Ensure join columns are indexed on both sides.• Look for scans on large tables.• Add covering indexes if a query is frequent.
    3. Validate results• Count expected rows before and after joins.• Watch for duplicates from unintended many to many joins.
    -- Quick cardinality check
    SELECT COUNT(*) FROM dbo.Orders;           -- base
    SELECT COUNT(*) FROM dbo.Orders o
    JOIN dbo.Customers c ON c.CustomerID = o.CustomerID;  -- after join
    
     
    If you share two table names and the fields you want to link, I will draft the exact JOIN with filters and indexes.

    Thank you! 
    Did I answer your question? Mark my post as a solution!
    Proud to be a Super User!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 624 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 381 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 225

Last 30 days Overall leaderboard