Q:

Running queries once only

I have an application which contains 2 buttons. 
Button 1 gives the result by this query:
select * from tbl1;

Button 2 gives the result by this queries:
select * from tbl1;
select * from tbl2;

So what's happening is that I have to run select * from tbl1 twice, Once for button 1 and once again for button 2. 
Is it possible to run both queries once when button 1 is clicked, but only show the results from tbl1, and then show the results from tbl2 when button 2 is clicked? 

A:

Yes, cache the result.  Store it into a variable (a collection like List) then use it to display result instead of re-evaluating the query.