Tuesday, January 24, 2012
SQL Joins
I've never used SQL joins frequently enough to remember which one is which, and end up looking them up. This visual explanation of joins using Venn diagrams is a great quick reference. The examples don't include duplicate in the tables, and it doesn't have a visual representation of a cross join a natural join or a self join.
Saturday, January 21, 2012
Concatenate rows into a text string
I needed to concatenate multiple rows of a table together in Caché SQL. I did this using XMLAGG, which returns all of the
values used within a specified column as a concatenated string. If I'd wanted the data to be comma separated then I could have used the LIST function instead.
If you want to do the same thing with a different database then Stack Overflow thread might be able to help.
SELECT ReportName,XMLAGG(ReportLine) As Report FROM Reports GROUP BY ReportName
If you want to do the same thing with a different database then Stack Overflow thread might be able to help.
Subscribe to:
Posts (Atom)