The List function in Firebird 2.1. This is an aggregate function that returns a string with the field values concatenated using a delimiter. the default delimiter is the comma. So it's similar to the SUM function, but instead of adding numbers, this function concatenate strings. if some of the values is null then the function returns null. So suppose I have 2 tables, projects and resources, and I know that a project will have a few resources assigned. Now I need to write a report of projects showing their resources assigned. CREATE TABLE projects( project_id INTEGER, name string ); CREATE TABLE resources( project_id integer, user_name string ); Without the LIST function I have to write this query SELECT p.project_id as id, p.name, r.user_name FROM projects p INNER JOIN resources r ON p.project_id = r.project_id my result will be like this id name user_name ------------------------- 1 Project_1 Steve 1 Project_1 John 2 Project_2 Jim 2 Proje
Comentarios
Publicar un comentario