-
Problem-Specific SQL Query
Hello Everyone,
Please get me the solution for the problem specified below:
Consider a table >
Column Name A B
23 g
26 m
23 h
55 a
26 k
23 s
I have to come up with a SQL query which can provide me with the output >
23 g, h, s
26 m, k
55 a
Regards,
Rahul
-
You have to write a cursor and a loop for this kind of output, it's not possible to do it using one sql statement.
-
Another option is to write a User Defined Function (if you are using SQL Server) which concats the fields like this.
-
Oracle also has table functions.
here is an article that show some of the functionality.
not a solution to your particular problem but shows how they are constructed.
http://www.databasejournal.com/featu...le.php/2222781
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|