title: Index of queries which returned value
body: <p>I have multiple queries builded from one schema, simple e.g.</p>
  
  <pre><code>SELECT * FROM some_table WHERE someparam = 'paramvalue1' UNION
  SELECT * FROM some_table WHERE someparam = 'paramvalue2' UNION ...
  </code></pre>
  
  <p>Queries are created by switching someparam value. Of course I'm able to change all the queries with sql IN operator and it should work the same way. But the thing is I need numbers of all queries, which gave me any results. So if queries with param value "paramvalue2" and "paramvalue5" returned me a result, then I want some column, e.g. "results" with values [2,5].
  What is the simplest way to do it? I need a solution that will work on PostgreSQL, MSSQL and Oracle.</p>
  
  <p>EDIT:
  I don't wanna mess with my schema query, which is e.g.:</p>
  
  <pre><code>SELECT * FROM some_table WHERE someparam = ?
  </code></pre>
  
  <p>That's just simple example, query can have multiple parameters and JOINS etc., I just wanna work on simple example.</p>
  
  <p>The result I want to get is number of query, which gave me any result at all, I don't need any values. The solution given by @Jasen is almost fine, cause the only change I need to do is replace "SELECT" with "SELECT  as results,". I wonder if it can be done without interfering in my query at all.</p>