vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have two tables M_SEG and G_SEG with contents MSEG GSEG ----- ------- BBB North America LLL Hawai CCC Asia Africa This table has nothing in common. I need the output as below MSEG GSEG ----- -------- BBB North America LLL North America BBB Hawai LLL Hawai BBB Asia LLL Asia BBB Africa LLL Africa I dont need a group by or order by thanks in advance.. |
| |||
| rAinDeEr wrote: > I have two tables M_SEG and G_SEG with contents > > MSEG GSEG > ----- ------- > BBB North America > LLL Hawai > CCC Asia > Africa > > This table has nothing in common. I need the output as below > > MSEG GSEG > ----- -------- > BBB North America > LLL North America > BBB Hawai > LLL Hawai > BBB Asia > LLL Asia > BBB Africa > LLL Africa > > I dont need a group by or order by > > thanks in advance.. > That's just a Cartesian Product with a filter on the primary table: select mseg, gseg from m_seg, g_seg where mseg != 'CCC'; Art S. Kagel |
| ||||
| rAinDeEr wrote: > Hi... > > The thing is that I need in that purticular order.... > If i give a simple select it doesnt give me the way i need the data, > North America twice with each of the other two and then the next and so > on... > > regards select mseg, gseg from m_seg, g_seg where mseg <> 'CCC' order by gseg desc, mseg'; |