soycharliente Posted June 20, 2007 Share Posted June 20, 2007 I'm not very hip to knowing how to do this and all the text I read is flying above my head. I have a table called officers with fields id, office, abbr, member. I have a table called profiles with many, many fields, but of interest, firstname, lastname, badge, and primaryEmail. The fields member and badge are the same (or could be if the person holds an office). I want to select firstname, lastname, and email from profiles where the member in officers equals badge in profiles (member and badge are both INTs). Does that make sense? Can someone help me? If possible, including an explanation of what is going on so that I can do it myself in the future. Quote Link to comment https://forums.phpfreaks.com/topic/56303-solved-selecting-from-multiple-db-tables/ Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 are trying to ask about joining tables example: SELECT firstname, lastname FROM table1, table2 WHERE member=badge and member=INTs and badge=INTs; thats the normal join if you whant to learn more read from basic tutorial of mysql Quote Link to comment https://forums.phpfreaks.com/topic/56303-solved-selecting-from-multiple-db-tables/#findComment-278117 Share on other sites More sharing options...
soycharliente Posted June 20, 2007 Author Share Posted June 20, 2007 I have no idea what any of that meant. You didn't even mention primaryEmail. Can you clarify how that works? Quote Link to comment https://forums.phpfreaks.com/topic/56303-solved-selecting-from-multiple-db-tables/#findComment-278119 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 http://w3schools.com/sql/sql_join.asp Quote Link to comment https://forums.phpfreaks.com/topic/56303-solved-selecting-from-multiple-db-tables/#findComment-278121 Share on other sites More sharing options...
soycharliente Posted June 20, 2007 Author Share Posted June 20, 2007 ... and all the text I read is flying above my head. I read that and asked for someone to help and ALSO explain it. If you don't want to, please don't post. Quote Link to comment https://forums.phpfreaks.com/topic/56303-solved-selecting-from-multiple-db-tables/#findComment-278122 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 okieeeeeeeeeeee SELECT === it easy ni need to explain firstname, lastname === this are the field you want to view add a existing field if u want FROM == clause initializing what table to use table1, table2 == the table that u want to use and join/combine WHERE == declaration of condition member=badge ==equality of two table(fiels) and == if theres is still condition u can add another and if u still have condition see next line member=INTs and badge=INTs; relax dont get mad ASTIG!!! hope that helps Quote Link to comment https://forums.phpfreaks.com/topic/56303-solved-selecting-from-multiple-db-tables/#findComment-278124 Share on other sites More sharing options...
soycharliente Posted June 20, 2007 Author Share Posted June 20, 2007 LOLOL. I'm not mad. What does ASTIG mean? I'll just call a friend and ask for help. Marking this as "solved". Quote Link to comment https://forums.phpfreaks.com/topic/56303-solved-selecting-from-multiple-db-tables/#findComment-278126 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 FILIPINO term for cool sorry for being rode Quote Link to comment https://forums.phpfreaks.com/topic/56303-solved-selecting-from-multiple-db-tables/#findComment-278128 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.