Re: How to get the row count
Posted by:
Thomas
Date: March 31, 2006 12:41AM
No both is not working in that way I meant here my SQL statement
SELECT m.*, r.*
FROM t_caveats m, v_invoice r, t_user u
WHERE n_caveats_id= ?
AND m.n_invoice_id = r.n_id
AND r.n_cust_id = ?
AND m.n_user_id = u.n_id
AND r.n_diff_day > 0
ORDER BY r.c_adr_cust
And I need in this statement the number of rows like
SELECT m.*, r.*, FETCHED_ROWS()
FROM t_caveats m, v_invoice r, t_user u
WHERE n_caveats_id= ?
AND m.n_invoice_id = r.n_id
AND r.n_cust_id = ?
AND m.n_user_id = u.n_id
AND r.n_diff_day > 0
ORDER BY r.c_adr_cust
Another way would be
SELECT m.*, r.*, rec.rec_count
FROM t_caveats m, v_invoice r, t_user u, (
SELECT count(*) rec_count
FROM t_caveats m, v_invoice r, t_user u
WHERE n_caveats_id= ?
AND m.n_invoice_id = r.n_id
AND r.n_cust_id = ?
AND m.n_user_id = u.n_id
AND r.n_diff_day > 0
) rec
WHERE n_caveats_id= ?
AND m.n_invoice_id = r.n_id
AND r.n_cust_id = ?
AND m.n_user_id = u.n_id
AND r.n_diff_day > 0
ORDER BY r.c_adr_cust
But this is not very nice