S Murder Posted June 25, 2007 Share Posted June 25, 2007 My SQL is a little rusty, and I need to know if this is possible.Given the table here: http://en.wikipedia.org/wiki/Join_(SQL)#Sample_tablesIs it possible for MySQL to return a row that will join Department and Employee where I'll have Department.DepartmentID, Department.DepartmentName, and a 3rd column Employee, which will be an array containing all the rows in Employee where DepartmentID matches?The real life scenario I'm doing is I need to store an hcard microformat, which can have multiple adr records associated with it. I need to retrieve the results into an associative array (because the keys contain the tag names) in PHP. The only current solution I can think of is manually doing separate SELECT statements for the adr table rows and adding them via PHP into my previous hcard result, which doesn't sound that appealing to me. Plus, addresses aren't mandatory, so if I did a normal join on hcard and adr when there's no matching adr rows, then I think I'll get 0 results. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 5, 2007 Share Posted July 5, 2007 SQL does not have support for structures like arrays, the entire row is an array. You can't group multiple fields automatically into one field. The result set would come back with the same departmentID and departmentName for every row, with each row having a different employee value. Link to comment Share on other sites More sharing options...
aspnetguy Posted July 6, 2007 Share Posted July 6, 2007 I don't think MySql has them but Sql server has Cursors which are like arrayshttp://jackdonnell.com/articles/SQL_CURSOR.htm Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.