treasured junkyard
JOIN same table
I have a table structure where two different rates are stored in the same table, and will be fetched in a single array of data. I tried to research for some forum, the I found one website that mentioned about joining the same table, so i tried to to have a query, and it works.. the query goes like this.
SELECT a.rate from rates a left join subjects b on b.rateid = a.id left join rates c on c.id = b.labid
the data is like this:
subject name rateid labid rate laboratory
english 1 2 200 500
math 3 4 250 550
then actual data is in :
fees table
id rate
1 200
2 250
3 500
5 550
| Print article | This entry was posted by losay on May 6, 2011 at 3:39 am, and is filed under Uncategorized. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |