SQL SELECT第一个和第四个数字



我在表中有ISBN编号9999-02-202-2,我需要检查第一个数字是否与第四个数字匹配,如何在postgresql中使用SELECT?

使用ANSI SQL:

select 
    case when substring('9999-02-202-2' from 1 for 1) = 
              substring('9999-02-202-2' from 4 for 1)
         then 1 else 0 end as matching_flag

最新更新