We've the below videos for CB Query Field to get started on using it. In its simplest form (Query fieldtype) you basically just supply your SQL and it outputs the results (if any and is valid SQL).
www.youtube.com/playlist?list=PLp0puRITgC7MM9iP9FooKB1qk8f5MLWVp
The below example should help get you started.
Code:
SELECT `invoice` FROM `#__cbsubs_payment_baskets` WHERE `user_id` = '[user_id]' AND `payment_date` IS NOT NULL ORDER BY `time_initiated` DESC LIMIT 1
Believe the above should output the invoice id of their most recently paid basket.