• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Distinct values from multiple rows and columns

 
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Martin Vajsar.
I used INITCAP function.
 
Martin Vashko
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic