• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Distinct values from multiple rows and columns

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a table named transport, which has 5 stoppage columns, namely, stoppage1,stoppage2,stoppage3,stoppage4,stoppage5

I need to get distinct values among all rows and columns.

Here is what i did :


This returns me

STOPS
A
B
C
a
D
c

According to requirement, i need the following output (only distinct values regardless of case) :

STOPS
A/a (any of two)
B
C/c (any of two)
D
 
Martin Vajsar
Sheriff
Pie
Posts: 3751
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the UPPER function to convert all values to uppercase.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Martin Vajsar.
I used INITCAP function.
 
Martin Vajsar
Sheriff
Pie
Posts: 3751
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kunal Lakhani wrote:Thanks for your reply Martin Vajsar.
I used INITCAP function.

You're welcome.

It is up to you to decide which records should be considered identical and which different. INITCAP does something different than UPPER, but if INITCAP meets your criteria, so be it. Using INITCAP to define uniqueness seems a bit strange to me, though (you're disregarding only the case of letters at the beginning of words, that looks quite arbitrary to me).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic