Netezza SQL query searching a concatenated value -
i using aginity workbench query netezza database , trying create simple query. basically, within table there 2 columns want combine create id (they make 2 parts of actual unique ids). within query want search unique ids e.g. idref value. in below example, want return rows within table column x equals 282 , z equals 55. below code isnt returning anything.
select t_route || csc idref, * hub_database postcode 'a%' , current_record_flag = '1' , idref = 28255 limit 100 ; so below code works ok in same way, trying use smarter method of doing , of course furthering sql knowledge.
select * hub_database t_route = '282' , csc = '55' , postcode 'a%' , current_record_flag = 1 limit 100;
use subquery. cannot refer column alias in same level defined:
select hb.* (select t_route || csc idref, hd.* hub_database hd postcode 'a%' , current_record_flag = '1' ) hb idref = 28255 limit 100 ; you error if idref defined in hub_database. if so, need use different name or remove column subquery.
Comments
Post a Comment