Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
brigo
Starting Member
1 Post |
Posted - 2012-02-25 : 03:36:38
|
Hi everyone.I have a question. I tried to make a page that would show info from 3 sql tables.First table contains id and main_topic,second table contains id id_main_topic and sub_topic,and third table contains id, main_topic_id, sub_topic_id, and unit_information.I try to do some thing like thismain_topic sub_topic unit_info sub_topic unit_infounit infounit infoWhat i mean, is some unit_info don't have a sub topic, so i try to attach them directly to main_topic. But i am stuck here, i can't get it working.I wrote a $sql=("Select * From main_topic_table");then inside of it a $sql2=("Select * FROM sub_topic where id_main_topic= $sql->id");then inside of this i wrote one moreSelect * FROM unit_info where sub_topic_id = $sql2 AND main_topic_id= $sql2->id_main_topic.All this bring me unit_info only of those columns which have both main_topic_id and sub_topic_id, but not the ones that have only main_topic_id.So i added to the last SELECT - OR (sub_topic_id=" " AND main_topic_id=$sql=id;But all this still don't get me anywhere.Could any one help me? Maybe there is another way to do that kind of stuff, could some one tell me?If you need me to give more information i will do so. Please some one help me, i can't get it working for a week now. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|