title: Convert Query from SQL server to SQLite Query
body: <p>I'm converting an existing application from an SQL Server database to SQLite I converted the tables and a lot of the queries but I couldn't convert this complex query and I need help</p>
  <p>Here is my query:</p>
  <pre><code>SELECT c.cust_id, c.name, c.phone, tr.price, tp.paid, tr.price - tp.paid AS debt, c.location, c.note, 
  c.date
  FROM Customers c CROSS apply (SELECT COALESCE (sum(tr.final), 0) AS price
  FROM transfers tr
  WHERE tr.cust_id = c.cust_id) tr CROSS apply
  (SELECT COALESCE (sum(tp.value), 0) AS paid
  FROM trans_payments tp
  WHERE tp.cust_id = c.cust_id) tp
  </code></pre>