mysql - Create multi column view from single column data -


i have following result sql query:

eventid          p_num  pn_namecount1   pn_name abc-i-10942683  1089213     1            company 1 abc-i-10942683  1326624     8            company 2 

i still learning capability in sql , need assistance, pivot's not working in scenario.

i have tried several different ways in attempting this, not able create desired results:

eventid          p_num1     pnc1    pn_name     pnc_num2      pnc2  pn_name abc-i-10942683  1089213     1       company     11326624        8   company 2 

the eventid change based on different events companies, eventid based on particular date event occurred company.

this sample of 500k+ rows of data working with. go temp table joined other various pieces of data needed.

i have tried without success:

  select key,           max(col1) col1,           max(col2) col2,           max(col3) col3      table  group key 

select eventid  , min(p_num) p_num1, min(pn_namecount1)  pnc1, min(pn_name) pn_name1 , max(p_num) p_num2, max(pn_namecount1)  pnc2, max(pn_name) pn_name2  table  group eventid   

this answer stated question. , stated in comment extend it.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -