You are here: collapse SELECT from multiple tables « PHP « IT news, forums, messages
collapse SELECT from multiple tables

Posted by David Christensen on 03/24/05 20:03

I'm trying to figure out the best way to handle a SELECT from multiple
tables where a single ID in tableA relates to multiple ID's in tableB:

"SELECT tableA.ID, tableB.data FROM tableA, tableB WHERE tableA.ID=3 AND
tableA.ID=tableB.tableAID"

What I'm trying to product is an array output similar to:

| ID | data |
| 3 | data1, data2, data3 |

if the table data is represented by this:

tableA
| ID | something |
| 1 | something1 |
| 2 | something2 |
| 3 | something3 |

tableB
| ID | tableAID | data |
| 1 | 3 | data1 |
| 2 | 3 | data2 |
| 3 | 3 | data2 |

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация