Can anyone guide me to resolve my problem . I need to write a procedure which first looks for the Worker names from WORKER table who satisfies certain criterias , and then Find from another table how many jobs each one has done on each day of a month . I have written a function which will return all days of a particular month, which can be used for the above procedure .If the wrokers are John , Alex and Martin ,( which may vary according to the branch parameter) The report should look like
Day John Alex Martin
1/5/2004 4 8 NULL
2/5/2004 5 9 12
How will your client code cope with never knowing how many columns might be returned? Building the row set isn't that hard, but there's no point in doing it unless you can deal with variable result sets (which is NOT as easy as it sounds).