Knowledgebase
[QODBC-Desktop] Querying Payroll Data - Linking Transaction to PayrollItemNonWage Tables and SQL Date Formatting
Posted by William - QODBC Support on 16 October 2026 09:44 AM

[QODBC-Desktop] Querying Payroll Data - Linking Transaction to PayrollItemNonWage Tables and SQL Date Formatting

Problem Description:

When trying to retrieve payroll withholding or deduction details (e.g., PA withholding, health insurance premiums) alongside transaction data from QuickBooks via QODBC, you need to know how to join the Transaction table with the PayrollItemNonWage table. Additionally, SQL date filtering requires a specific format unique to QODBC.

Affected products: QODBC Desktop, QuickBooks Desktop with Payroll
Expected outcome: After using the correct INNER JOIN on AccountRefListID or AccountRefFullName, and the proper date literal format {d 'YYYY-MM-DD'}, payroll withholding data can be queried successfully.

Symptoms:

  • You need to link payroll item definitions (withholding rates, amounts) to their corresponding transactions but don't know the join condition.
  • Date filtering in WHERE clauses returns unexpected results or errors when using standard SQL date formats like 'YYYY-MM-DD'.
  • The Transaction table and PayrollItemNonWage tables appear unrelated, making it unclear how to join them for payroll reports (e.g., paystubs).

Cause:

QODBC stores payroll withholding and deduction data in the PayrollItemNonWage table. Each record contains a LiabilityAccountRefListID (or LiabilityAccountRefFullName) field that maps to the corresponding account in the Transaction table's AccountRefListID (or AccountRefFullName). The Transaction table logs all financial activity, including payroll-related transactions.

For date filtering, QODBC uses QuickBooks SDK's date literal syntax {d 'YYYY-MM-DD'} rather than standard SQL date strings.

Environment:

ProductVersion / Detail
QODBC Desktop All versions (with Payroll enabled)
QuickBooks Desktop All editions with Payroll module

Solution:

Step 1: Join Transaction to PayrollItemNonWage

Use the INNER JOIN on either ListID or FullName to link payroll items to their transactions:

SELECT * FROM Transaction INNER JOIN PayrollItemNonWage
  ON Transaction.AccountRefListID = PayrollItemNonWage.LiabilityAccountRefListID
SELECT * FROM Transaction INNER JOIN PayrollItemNonWage
  ON Transaction.AccountRefFullName = PayrollItemNonWage.LiabilityAccountRefFullName

To retrieve specific transaction details alongside payroll item info:

SELECT TxnType, TxnID, TxnLineID, RefNumber, Amount, FQTxnLinkKey, FQJournalEntryLinkKey, FQPrimaryKey
FROM Transaction INNER JOIN PayrollItemNonWage
  ON Transaction.AccountRefListID = PayrollItemNonWage.LiabilityAccountRefListID

Step 2: Join Transaction to TimeTracking (Optional)

To link paychecks to customer/job information from the TimeTracking table:

SELECT * FROM Transaction INNER JOIN TimeTracking
  ON Transaction.EntityRefListID = TimeTracking.CustomerRefListID
WHERE TxnType = 'PayCheck'

Step 3: Use QODBC Date Format in WHERE Clauses

QODBC requires the date literal format {d 'YYYY-MM-DD'} for SQL queries. Do NOT use standard single-quoted dates:

SELECT * FROM InvoiceLine WHERE TxnDate >= {d '2005-09-23'}

Correct: {d '2024-01-15'}

Incorrect: '2024-01-15', "2024-01-15", '01/15/2024'

SQL Examples:

SELECT * FROM Transaction WHERE TxnDate >= {d '2024-01-01'}
AND TxnType = 'PayCheck'
SELECT * FROM Transaction INNER JOIN PayrollItemNonWage
  ON Transaction.AccountRefListID = PayrollItemNonWage.LiabilityAccountRefListID
WHERE Transaction.TxnDate >= {d '2024-06-01'}

Example Scenarios:

Scenario - Building Paystubs via QODBC:

A customer needed to generate paystubs from QuickBooks data. They queried the Transaction table joined with PayrollItemNonWage using the AccountRefListID link, filtered dates with {d 'YYYY-MM-DD'}, and mapped each withholding line item (PA withholding, health insurance, 401(k)) to its corresponding amount for printing.

Additional Notes:

  • LiabilityAccountRefListID vs FullName: Use ListID when you have exact matches; use FullName when you need flexibility with account name variations.
  • Date formats: QODBC is strict about date syntax. Using the wrong format will return no results or errors. Always use {d 'YYYY-MM-DD'} for date filtering.
  • Note on paycheck-to-customer linking: If a customer/job is linked to a paycheck after it's created, QuickBooks updates the TimeTracking table record rather than creating a new transaction entry. The link between paycheck and customer is stored in the TimeTracking.CustomerRefListID field.

How to Query Invoice Data via QODBC Understanding Transaction Table Fields in QuickBooks

Keywords:

QODBC PayrollItemNonWage Transaction Table INNER JOIN Date Format {d} PayStub Withholding LiabilityAccountRef TimeTracking QuickBooks Payroll
(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please complete the captcha below (we use this to prevent automated submissions).