Ton of stuff where I am formatting the vars....
END;
echo $content;
}
My question is "How do I combine them so I sort by the $TID#1 in the first sql and list the friends then loop back and get TID#2 and list the friends and loop back and get $TID#3 and list the friends and so on....
Thank You very much for the help and as usual...I am not looking for someone to write the code for me...just explain how it should work with an example.
Ton of stuff where I am formatting the vars....
END;
echo $content;
}
My question is "How do I combine them so I sort by the $TID#1 in the first sql and list the friends then loop back and get TID#2 and list the friends and loop back and get $TID#3 and list the friends and so on....
Thank You very much for the help and as usual...I am not looking for someone to write the code for me...just explain how it should work with an example.
Thank You for your time!
Dawg
This assumes that the friend table has a name field. If not then just change the field name.
If you only want to list towns that have at least 1 friend, then try this query.
Code:
SELECT t.tid, f.name
FROM town_name AS t, friend AS f
WHERE t.tid = f.tid
ORDER BY t.tid, f.name
If you want to list all towns regardless of how many friends, then try this query.
Code:
SELECT t.tid, f.name
FROM town_name AS t LEFT JOIN friend AS f
ON t.tid = f.tid
ORDER BY t.tid, f.name
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum