How to join several MySQL tables I have the following 4 MySQL tables:
table1
- entry11
- entry12
- entry13
- entry14
table2
- entry21
- entry22
- entry23
table3
- entry31
- entry32
- entry33
- entry34
- entry35
table4
- entry41
- entry42
- entry43
The relations between the different tables are:
entry21 = entry12
entry31 = entry22
entry41 = entry23
The output should be sorted with the following criterions:
1. entry12 (ascending)
2. entry22 (ascending)
3. entry23 (ascending)
4. entry34 (descending)
5. entry42 (ascending)
6. entry43 (ascending)
I've not much experience with MySQL but I think I have somehow to join
these 4 tables to a temporary table (e.g. joined-table) so that I can
do
$db_query = "SELECT * FROM joined-table ORDER BY entry12 ASC, entry22
ASC, entry23 ASC, entry34 DESC, entry42 ASC, entry43 ASC";
Is that correct and if yes, how can I join these 4 tables?
Will this joined table only be available in the memory? If yes, how
long will this joined table be available in the memory?
Regards
Stefan |