Hi everybody! I'm looking to write a query that pu...
# suiteql
s
Hi everybody! I'm looking to write a query that pulls a distinct list of customer.internalId and projectId from employee time entries within a set date period. Eventually, I would record transform each result to an invoice, in an attempt to automatically generate invoices. I'm having trouble figuring out how to join "timebill" to "customer". Also, is my overall logic correct or should I try something else?
Copy code
SELECT DISTINCT
    t.customer,
    c.internalId
FROM
    timebill as t
    JOIN
        customer as c
        ON ??
WHERE 
    t.trandate BETWEEN x and y
m
You can join like this. Notice that it's
id
rather than
internalId
on the customer record.
Copy code
select distinct
  t.customer,
  c.id,
from timebill t
inner join customer c on t.customer = c.id
where t.trandate > '1/1/2020'
s
Thanks!