Search code examples
sqldatabaseinformix

Select hardcoded values in Informix DB


I need to select hardcoded values in one column, so I will be able to join them with table in Informix DB. So I try in different variations to do something like this:

select a from ( values (1), (2), (3) ) ;

And I expect to get results:

1
2
3

I think in other DB this or some other variations that I tried would return the values. However, in Informix it does not work.

Could anyone suggest the solution working in Informix please?


Solution

  • Informix requires an actual query statement. I think this will work:

    select a
    from (select 1 as a from systables where tabid = 1 union all
          select 2 as a from systables where tabid = 1 union all
          select 3 as a from systables where tabid = 1
         ) t;