chunkII123
IS-IT--Management
I currently have a 'view' setup so it polls a couple tables for a java desktop program. The problem is, I need to add another table column from another table, and have the values concatenated separated by ', '. heres is what the current view looks like -
(Sorry for the length of it)
Now the column I need to add is each member's hobbies, from the 'hobbies' table which is LEFT JOIN(ed) to the 'possiblehobbies' table to change the 'hobbies' numberical value to the 'possiblehobbies' name value. the hobbies table can be joined to the original view on 'membernumber' as you will see.
Example of the Table(s)
'Hobbies'
---------------------------
membernumber | HobbyID
980000 | 10
980000 | 23
980002 | 67
---------------------------
PossibleHobbies'
---------------------------
ID | Name
10 | Bowling
23 | Car Racing
67 | Dining
---------------------------
Anyhow, you get the idea. I have tried using GROUP_CONCAT(DISTINCT.....) within the current view, and joining the tables, however, this causes retuned rows to add the additional column, and become one row. I there a less ambiguous call than GROUP_CONCAT, or a way to add a statement similar to WHERE within the GROUP_CONCAT context?
Any help is much appreciated. Thank you all ahead of time!
Beware of hackers bearing executables. Happy Hunting. 'irc.2600.net'
Code:
select cp.membernumber AS MemberNumber, mcp.membernumber AS MatchesMemberNumber, cp.FirstName AS FirstName, concat(cp.FirstName, ' ', cp.LastName) AS FullName, cp.CallFirst AS callfirst, cp.HomePhone AS HomePhone, cp.StreetAddress AS StreetAddress, cp.City AS City, cp.State AS State, cp.Zip AS Zip, cp.Email AS email, cp.HideLastName AS HideLastName, cp.HideAddress AS HideAddress, cp.HideAge AS HideAge, mcp.CallFirst AS matchescallFirst, mcp.FirstName AS MatchesFirstName, concat(mcp.FirstName, ' ', mcp.LastName) AS MatchesFullName, mcp.HideLastName AS HideMatchesLastName, mcp.HideAge AS HideMatchesAge, mcp.HomePhone AS MatchesHomePhone, mcp.StreetAddress AS MatchesStreetAddress, mcp.City AS MatchesCity, mcp.State AS MatchesState, mcp.Zip AS MatchesZip, mcp.Occupation AS Occupation, mcp.dateofbirth AS DateOfBirth, mcp.HairColor AS HairColor, mcp.EyeColor AS EyeColor, mcp.Education AS Education, mcp.HeightFeet AS HeightFeet, mcp.HeightInches AS HeightInches, mcp.Race AS Race, mcp.Religion AS Religion, mcp.InfoForOthers AS InfoForOthers, mcp.Preferences AS Preferences, mcp.Gender AS Gender, mcp.MaritalStatus AS MaritalStatus, mcp.dateofbirth AS MatchesDateOfBirth, mcp.NumberOfChildren AS numberofchildren, mcp.HideAddress AS HideMatchesAddress, matches.DateMatched AS DateMatched, matches.DateSent AS DateSent, matches.DateScheduled AS DateScheduled, matches.DateApproved AS DateApproved, (timestampdiff(YEAR, mcp.dateofbirth, now()) - if((mcp.dateofbirth > now()), 1, 0)) AS Age, cp.receiveEmail AS receiveemail, cp.receiveMail AS receivemail h.hobbyID
from ((matches join membersinformation cp on((cp.membernumber = matches.membernumber)))
join membersinformation mcp on((mcp.membernumber = matches.matchesmembernumber)))
join hobbies h on h.membernumber = cp.membernumber
where isnull(matches.DateSent)
(Sorry for the length of it)
Now the column I need to add is each member's hobbies, from the 'hobbies' table which is LEFT JOIN(ed) to the 'possiblehobbies' table to change the 'hobbies' numberical value to the 'possiblehobbies' name value. the hobbies table can be joined to the original view on 'membernumber' as you will see.
Example of the Table(s)
'Hobbies'
---------------------------
membernumber | HobbyID
980000 | 10
980000 | 23
980002 | 67
---------------------------
PossibleHobbies'
---------------------------
ID | Name
10 | Bowling
23 | Car Racing
67 | Dining
---------------------------
Anyhow, you get the idea. I have tried using GROUP_CONCAT(DISTINCT.....) within the current view, and joining the tables, however, this causes retuned rows to add the additional column, and become one row. I there a less ambiguous call than GROUP_CONCAT, or a way to add a statement similar to WHERE within the GROUP_CONCAT context?
Any help is much appreciated. Thank you all ahead of time!
Beware of hackers bearing executables. Happy Hunting. 'irc.2600.net'