简体   繁体   English

使用 TERADATA 中的单个函数获取反转值

[英]Get inverted value with single function in TERADATA

Can you guys help me go through this:你们能帮我解决这个问题吗:

Input: 
First_Name    Last_Name
John          Smith
Smith         John

Output:
Customer_Name
John Smith
John Smith

So basically, what I want here is to get the Customer Name as sometimes the First & Last name are inverted in the database and I would like to do it in TERADATA using just a function (of possible of course) without using UNION/UNION ALL for example.所以基本上,我在这里想要的是获取客户名称,因为有时名字和姓氏在数据库中被反转,我想在 TERADATA 中只使用一个函数(当然可能)而不使用 UNION/UNION ALL例如。

You can do a little alphabetical comparison between the two columns and take the min and the max in any case Example:您可以在两列之间进行一些字母顺序比较,并在任何情况下取最小值和最大值 示例:

select 'John' as a ,'Smith' as b ,case when a > b then a else b end Less_
    ,case when a <= b then a else b end More_

Regards,问候,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM