Archive for the 'SQL' Category

27
Sep

Creating Recursive SQL Calls for Tables with Parent-Child Relationships

Recursive SQL CallsI ran into an interesting problem today while considering how to find out where subordinate employees fit into an organizational chart. The problem was that I need to list every employee that was “under” a given employee, but could only really do this in SQL - if I were to try and do this from within PHP, it would have made a single exception case where we build an SQL query based on another query - something I’d rather not have to do. Let’s see if this little graph can more adequately describe what the issue was:

Continue reading ‘Creating Recursive SQL Calls for Tables with Parent-Child Relationships’




Close
E-mail It