mdmartiny Posted September 24, 2011 Share Posted September 24, 2011 I am fairly new to MySQL so I am still learning things. I have two tables one is a numbered checklist(1990ToppsTraded) and the other is a table(ttmautos) filled with different types of information. Depending on what is put in a certain field(collection) of ttmautos. If the collection field says "1990 Topps Traded" it will place a 1 in the signed field of 1990ToppsTraded. Is there a way for me to do this in the database or do I have to do it through a SQL Query in my page? How would I do it either way. Any Help would be appreciated in this manner Quote Link to comment https://forums.phpfreaks.com/topic/247755-cross-referencing-tables/ Share on other sites More sharing options...
fenway Posted September 24, 2011 Share Posted September 24, 2011 I have no idea what you're talking about, probably because your DB design is very confusing -- you have a table and field named the same thing. Quote Link to comment https://forums.phpfreaks.com/topic/247755-cross-referencing-tables/#findComment-1272275 Share on other sites More sharing options...
mdmartiny Posted September 24, 2011 Author Share Posted September 24, 2011 Ok I will try and clarify it up some. I have two databases 90toppstraded and ttmautos. In the 90toppstraded database their is a field called signed that gets a variable of either 1 or 0. In the ttmautos database their is a field called project that has different data in it based on the project. What I am want to do is fill the signed field of 90toppstraded with a one every time that the project field of the ttmautos database says "1990 Topps Traded". I am hoping to do this with out having to enter it manually every time. Quote Link to comment https://forums.phpfreaks.com/topic/247755-cross-referencing-tables/#findComment-1272301 Share on other sites More sharing options...
fenway Posted September 24, 2011 Share Posted September 24, 2011 You're not supposed to have that boolean value -- you're supposed to join the tables. Quote Link to comment https://forums.phpfreaks.com/topic/247755-cross-referencing-tables/#findComment-1272410 Share on other sites More sharing options...
mdmartiny Posted September 27, 2011 Author Share Posted September 27, 2011 I understand the join function to a point. However I want all of the information to be displayed from the 90toppstraded database. It is a checklist of sorts. I want it to show what signatures I have and what signatures I still need to complete the list. Is there a way that I can do that? I am pretty new to MySQL and I understand the basics of it. So excuse me for my ignorance on this matter Quote Link to comment https://forums.phpfreaks.com/topic/247755-cross-referencing-tables/#findComment-1273264 Share on other sites More sharing options...
awjudd Posted September 28, 2011 Share Posted September 28, 2011 Do a LEFT JOIN onto the table where the person has the signatures ... For example (no fields were given, so I am making the fields up): SELECT * FROM ttmautos a LEFT JOIN 90toppstraded b ON a.AutoID = b.AutoID This will retrieve every row in the ttmautos table and either NULL if there is no matching row in the 90toppstraded table OR the row from that table where there is the match. Hope this helps. ~juddster Quote Link to comment https://forums.phpfreaks.com/topic/247755-cross-referencing-tables/#findComment-1273398 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.