sql - How to select columns of different lengths -


i have table of part numbers along many of properties such:

[part number] [type] [manager] [cat. code] [etc...]   aaa-001            dave       123   ddd-008       d      chris      153   bbb-003       b      dave       254   ccc-008       c      dave       153   ... 

i'm trying make list of unique values of each property looks more this:

[type] [manager] [cat. code] [etc...]        dave       123   b      chris      153   c                 254   d 

however whenever try using select distinct * or like, fills columns they're same length longest one, filled horizontally according original table:

[type] [manager] [cat. code] [etc...]        dave       123   b      dave       254   c      dave       153   d      chris      153 

how stop happening, , keep unique values of each column, if might different lengths?

i think you've misunderstood distinct does. filter results rows returned unique, not each column. depending columns named in select, you'll different results. example, see http://www.techonthenet.com/sql_server/distinct.php , section "example - multiple expressions"

for case, if want lists of unique values in each column, you'll have separate query on each column, e.g.:

select distinct [type] [parts] select distinct [manager] [parts] ...etc 

if want them side-by-side (as per sample desired output), you'll have copy , paste them spreadsheet or something.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -