|
[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 FormattingProblem 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 Symptoms:
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 Environment:
Solution:Step 1: Join Transaction to PayrollItemNonWageUse 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 ClausesQODBC 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: Incorrect: 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:
Related Articles: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
| |||||||
|
|
|||||||


