✏️ Explanatory Question
If you're interested only in records that exist in both tables (i.e., the relationship exists), go for Inner Join.
✅ Example: List all customers who have placed at least one order and include both customer and order data.
while select customer
join salesTable
where salesTable.CustAccount == customer.AccountNum
{
// Returns only customers with matching sales orders
// Both table data is available
}
Unlike Exists Join, which doesn’t return data from the joined table, Inner Join lets you fetch fields from both tables.
Used heavily in reports, forms, and classes where you need:
Order + Customer
Product + Inventory
Project + Transactions
Use it when your logic depends on records existing in both tables (e.g., linking foreign keys).
✅ Example: Fetch all posted journals along with their respective voucher transactions.
| Use Case | Use Inner Join? |
|---|---|
| Need only matched records from both tables | ✅ Yes |
| Need fields from both tables | ✅ Yes |
| Need unmatched records from main table | ❌ Use Outer Join |
| Need to filter main table based on child only | ❌ Use Exists Join |
| Need to exclude records with child records | ❌ Use NotExists Join |