Only reutrn data if query doesnt return empty set

(2 posts) (2 voices)

Tags:

No tags yet.

  1. SBurke, Member

    I suppose this is more of a SQL question than myDBR.

    We have a query that has a stupid amount of columns. But there will seldom be any rows.

    As the report is emailed, we would like some kind of conditional reporting where it would email/display results only if there are any rows to display.

    Is it feasible?

  2. myDBR Team, Key Master

    You've got few options how to deal with it depending on the complexity of your query:

    - Use dbr.no_data
    - If the query is a simple one, count the number of rows first into a variable and do the query only if rowcount>0
    - If the query is complex, put the output of the query into temp-table and then count rows in temp-table before making the query from temp-table

    --
    myDBR Team


Reply

You must log in to post.