Click here to Skip to main content
15,917,642 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: Passing Values to the next Page in PHP Pin
ZurdoDev19-Aug-16 3:26
professionalZurdoDev19-Aug-16 3:26 
QuestionBasic Join Not Working Pin
Django_Untaken19-Aug-16 0:43
Django_Untaken19-Aug-16 0:43 
Hello there. I am trying to get data from 3 different tables based on simple join. One of the tables can have multiple values against one primary key. Here are the table designs

Table 1 - EmployeeDetails
SQL
EmployeeId INT, FirstName VARCHAR, SurName VARCHAR, SexId INT 
Table 2 - EmployeeSex
SQL
SexId INT, Sex VARCHAR
-- Values inserted
-- 1, Male
-- 2, Female
Table 3 - EmployeeContacts
SQL
EmployeeId INT, Contact VARCHAR -- may or may not be null AND can contain multiple values
I am using following query
SQL
SELECT ED.EmployeeId, ED.FirstName, ED.SurName, GROUP_CONCAT(EC.Contact) 
FROM EmployeeDetails ED, EmployeeSex ES, EmployeeContacts EC
WHERE ED.SexId = ES.SexId AND ED.EmployeeId = EC.EmployeeId AND ED.EmployeeId = 'emp_password';
Now this query works fine if we have at least one contact number. But if there are not contacts, then this results in empty set. What is wrong with this query ? How can I improve so that it works in all scenarios (regardless of number of contacts in EmployeeContacts table). Thanks for any input.

modified 19-Aug-16 7:10am.

SuggestionRe: Basic Join Not Working Pin
Richard MacCutchan19-Aug-16 2:00
mveRichard MacCutchan19-Aug-16 2:00 
GeneralRe: Basic Join Not Working Pin
Django_Untaken19-Aug-16 2:17
Django_Untaken19-Aug-16 2:17 
GeneralRe: Basic Join Not Working Pin
Richard MacCutchan19-Aug-16 3:14
mveRichard MacCutchan19-Aug-16 3:14 
GeneralRe: Basic Join Not Working Pin
johnjonny10-Oct-16 8:18
johnjonny10-Oct-16 8:18 
Questionassignment Pin
Eto'o3-Aug-16 12:15
Eto'o3-Aug-16 12:15 
AnswerRe: assignment Pin
Richard MacCutchan3-Aug-16 22:02
mveRichard MacCutchan3-Aug-16 22:02 
QuestionGoogle Translate facility Pin
Member 1264382519-Jul-16 18:51
Member 1264382519-Jul-16 18:51 
AnswerRe: Google Translate facility Pin
Richard MacCutchan19-Jul-16 22:39
mveRichard MacCutchan19-Jul-16 22:39 
QuestionFor Linux Admin Fresher Pin
Abijith Ajayan12-Jul-16 18:05
Abijith Ajayan12-Jul-16 18:05 
AnswerRe: For Linux Admin Fresher Pin
Richard MacCutchan12-Jul-16 21:28
mveRichard MacCutchan12-Jul-16 21:28 
Questionpaypal account Pin
Kannan Kalai28-Apr-16 21:21
Kannan Kalai28-Apr-16 21:21 
AnswerRe: paypal account Pin
Eddy Vluggen26-May-16 23:47
professionalEddy Vluggen26-May-16 23:47 
QuestionCan anyone recommend me a good php 7 hosting provider? Pin
masterarts11-Mar-16 2:11
masterarts11-Mar-16 2:11 
AnswerRe: Can anyone recommend me a good php 7 hosting provider? Pin
PHP Stack17-Mar-16 0:27
PHP Stack17-Mar-16 0:27 
AnswerRe: Can anyone recommend me a good php 7 hosting provider? Pin
Martin VS1926-May-16 23:21
Martin VS1926-May-16 23:21 
AnswerRe: Can anyone recommend me a good php 7 hosting provider? Pin
ribluc30-May-16 20:17
ribluc30-May-16 20:17 
QuestionPhotos album Pin
Member 123680953-Mar-16 11:59
Member 123680953-Mar-16 11:59 
SuggestionRe: Photos album Pin
Richard MacCutchan3-Mar-16 21:48
mveRichard MacCutchan3-Mar-16 21:48 
Questioncalendar Events using PHP Pin
mharie17-Feb-16 2:43
mharie17-Feb-16 2:43 
QuestionJSON and Mysqli Pin
vinay dahiya4-Feb-16 19:16
vinay dahiya4-Feb-16 19:16 
QuestionRe: JSON and Mysqli Pin
Richard MacCutchan4-Feb-16 21:36
mveRichard MacCutchan4-Feb-16 21:36 
AnswerRe: JSON and Mysqli Pin
Mohd Shibli15-Sep-16 18:48
professionalMohd Shibli15-Sep-16 18:48 
GeneralRe: JSON and Mysqli Pin
Richard MacCutchan15-Sep-16 22:37
mveRichard MacCutchan15-Sep-16 22:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.