ÖMER
ÖMER

Reputation: 303

Combine Multiple Rows into One Cell Using SQL

enter image description here

Hello guys, maybe this is a basic SQL question. How can I combine multiple rows into one cell using SQL?

Expected Result:

enter image description here

Thanks in advance!

Upvotes: 0

Views: 324

Answers (1)

Albert D. Kallal
Albert D. Kallal

Reputation: 49264

You can't do this in a query output, but you most certainly can do this in a report.

So, say this simple query of some City and Hotels:

enter image description here

However, a datasheet output is not suitable for formatted output, and thus you can (should) use a report, and that will allow you to group say the city together, and hide repeating values.

So, a report then can output the above like this:

enter image description here

And note that you can place a report (as sub form) into an existing form, so even if you not "reporting" the data but only for display, then once again, a report will allow such grouping.

As a general rule, data output to a datasheet view is not formatted, and such output is quite much only for developers. However, for your "users" of the application, then formatting such query output can and should be done with a report.

Upvotes: 1

Related Questions