rwrogers Posted November 6, 2013 Share Posted November 6, 2013 I'm trying to setup a form where users can search using one or more fields, such as firstname, lastname, office. However, the info is coming from multiple tables. Here is the query I have so far, I've gotten rid of the errors, but now it doesn't return any rows. SELECT A.firstname, A.lastName, O.Name, R.Position FROM AttorneyData A, Offices O, AttorneyPositions R WHERE O.id='2' AND R.Position='3' AND A.firstName='Test' AND A.lastName='User' ; Any ideas would be greatly appreciated. Richard Quote Link to comment https://forums.phpfreaks.com/topic/283666-newbie-question-on-query/ Share on other sites More sharing options...
Barand Posted November 6, 2013 Share Posted November 6, 2013 (edited) Table structure? How are those three tables related? Edited November 6, 2013 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/283666-newbie-question-on-query/#findComment-1457274 Share on other sites More sharing options...
rwrogers Posted November 6, 2013 Author Share Posted November 6, 2013 (edited) Well no relationship set, like I would like. In the AttorneyData table, there is an "Office" id that is the same as the "id" in the Offices table php 5.4.12 mysql 5.6.12 Richard Edited November 6, 2013 by rwrogers Quote Link to comment https://forums.phpfreaks.com/topic/283666-newbie-question-on-query/#findComment-1457275 Share on other sites More sharing options...
Barand Posted November 6, 2013 Share Posted November 6, 2013 Is there and attorneyid in the attorney positions table? Quote Link to comment https://forums.phpfreaks.com/topic/283666-newbie-question-on-query/#findComment-1457282 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.