i am facing as issue, here's my database (an example ) id class name 1 class1 jon 2 class1 mac 3 class1 jim 4 class1 suzy 5 class1 ryan 1 class2 aron 2 class2 kaz 3 class2 taz 4 class2 jazz 1 class3 raffy 2 class3 taffy 3 class3 tammy 4 class3 jammy 5 class3 yammy now i want the results to be displayed as 1 class1 jon | class2 aron | class3 raffy 2 class1 mac | class2 kaz | class3 taffy 3 class1 jim | class2 taz | class3 tammy 4 class1 suzy | class2 jazz | class3 jammy 5 class1 ryan | |||||||||| | class3 yammy i tried using joins of all kinda, i was able to kinda get the structure though but i was missing out the fifth element which is wat i wanted as i need to identify if theres a missing person in any class. The database is pretty huge. the sql statement i used was, but like i said, using this the fifth element goes out missing, wat i need is soace or null or anything which indicates a missing person in a class. Help appreciated.
You didn't say which DB, so in Oracle something like this would bring back the results. select c1.class || ' ' || c1.name class_1 || ' | ' || c2.class || ' ' || c2.name class_2 || ' | ' || c3.class || ' ' || c3.name class_3 from tbl1 c1, tbl2 c2, tbl3 c3 where c1.class = 'class1' and c2.class = 'class2' and c3.class = 'class3'