Hi everyone, I’m running a SQL query on invoices u...
# suiteql
r
Hi everyone, I’m running a SQL query on invoices using the column daysOverdueSearch (SQL) versus daysOverdue (saved search). I’ve noticed a discrepancy between the two: • In the saved search, an invoice shows Days Overdue = 1, but the SQL shows 0. • In another case, the SQL shows 4, while the saved search shows 5. Does anyone know what might be causing this difference? Could it be related to a date conversion or time zone issue, or is there another factor I should check to align the results? Based in AU
Copy code
SELECT 
                t.tranid AS inv_no,
                t.id AS inv_id,
                t.trandate AS inv_date,
                t.daysOverdueSearch AS days_overdue,
                t.foreignAmountUnpaid AS amount_remaining,                
                t.status AS inv_status_id,
                BUILTIN.DF(t.status) AS inv_status_text
            FROM 
                transaction t
I used the following to get the correct dates to match but wondering if there is a better way
Copy code
TRUNC(CURRENT_DATE) - TRUNC(t.duedate) AS days_overdue2,