我有一张这样的表 -
tableCountry
我想写一个查询来列出以下组合 -
>USA-UK
>USA-Germany
>UK-USA
>UK-Germany
>Germany-USA
>Germany-UK
这样的组合列表是否可以通过postgresql?
感谢。
答案 0 :(得分:2)
这很简单:
select
x.transaction_id
from
nsbt_atm_trx_log_13763 x
inner join
nsbt_host_trx_log_13763 y on x.transaction_id = y.transaction_id
where
to_char(x.transaction_date) <> to_char(y.transaction_date)
or to_char(x.business_date) <> to_char(y.business_date)
or to_char(x.transaction_value_date) <> to_char(y.transaction_value_date)
or x.transaction_type<> y.transaction_type
or x.account_number <> y.account_number
or x.customer_id <> y.customer_id
or x.transaction_amount <> y.transaction_amount;