David,
It is not clear to me what your are trying to do.... What are you trying to get back? A set of tables? If that is the case, I would use your first approach, or create a server-side view that provides it all... Little more info would be great!
Ricardo A. Parodi
eSolar, Inc.