Base sybase. There is a query to which you need to add the castom_name field from the IPS.tszone table. The problem is that in IPS.tszone many fields can have

t5.zone_alias = cast (t1.RET_ID as CHAR)

And plus to the whole custom_name there can be two options, either a char field (unique) or null. It is necessary to get exactly this unique char field. Here is the original request.

select t1.Tran, t1.ShedulType from PAN.TabelReg as t1 

Here is a modified

  select t1.Tran, t1.ShedulType, t5.custom_name from PAN.TabelReg as t1 left join IPS.tszone as t5 on t5.zone_alias = cast(t1.RET_ID as CHAR) 
  • show the structure of the tables! - Yaroslav
  • Something I do not see the difference of the modified request - teran
  • @teran corrected - alex safsafsd
  • so what's left is to filter ret_id which are not null ? Without a description of the table and examples of data is really not very clear. - teran
  • how it works: left join IPS.tszone as t5 on t5.zone_alias = cast (t1.RET_ID as CHAR) - Yaroslav

0