Skip to content

Tag: sql

Sort alphanumeric ID number

I have a database that every transactions get a alphanumeric ID. By when I write my query and use Order by it give me a wrong sequence. For example: TRN_ID TRNDTE 000002DAAW 2020-09-12 03:45:24 …

SQL Subquery to handle duplicates

So I am joining to tables, however the table I want to left join has duplicate values for the matching field. I am trying to create a subquery so that when there are duplicates the column value is assigned ‘Duplicate’ and when there isn’t then it takes the value of the join. Here is simplifi…