ms access - Move values from 1 column to multiple rows organized by a unique identifier MSAccess/SQL -


sql newbie here. have work task i'm trying expidite using msaccess/sql familiar with!

i have spreadsheet on 6000 unique rows looks this:

| sampleid | unique id |   |    123     |    abc    |   |    124     |    abc    |   |    125     |    abc    |   |    456     |    def    |   |    457     |    def    |   |    458     |    def    |   |    789     |    ghi    |   |    790     |    ghi    |   |    791     |    ghi    |  |    792     |    ghi    | 

and i'd move values sampleid individual columns, based on uniqueid, so:

| uniqueid | sampleid1 | sampleid2 | sampleid3 | sampleid4 |  | abc | 123 | 124 | 125 |  |  | def | 456 | 457 | 458 |  |  | ghi | 789 | 790 | 791 | 792 | 

i'm attempting in sql/msaccess using queries on imported excel table has on 6000 rows.

i've managed count maximum number samples per uniqueid: 55.

is there way use pivot based grouped uniqueid? how should / how msaccess/sql handle null values?

you can use pivot same...

select *  (     select sampleid, unique_id     table1 ) x pivot (     max(unique_id)     sampleid in ([sample1], [sample3], [sample3], [sample4],....) ) p 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -