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 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 Table structure? How are those three tables related? 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 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 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? Link to comment https://forums.phpfreaks.com/topic/283666-newbie-question-on-query/#findComment-1457282 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.