473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

question about cursor

I have a table like this:

tblProductTag
productID - tag
1 - 'tag1'
1 - 'tag2'
1 - 'tag3'
2 - 'tag1'
2 - 'tag2'

I want to write some SQL that will result in this:

productID - tag
1 - 'tag1, tag2, tag3'
2 - 'tag1, tag2'


What is the best way to achieve this? I was thinking about cursor, but not too sure.
Jul 19 '09 #1
5 2236
ck9663
2,878 Expert 2GB
Use PIVOT/UNPIVOT

Good luck!!

--- CK
Jul 19 '09 #2
But doesn't PIVOT/UNPIVOT require aggregate functions?
Jul 20 '09 #3
ck9663
2,878 Expert 2GB
Yes, but you can just use MIN() or MAX()

--- CK
Jul 22 '09 #4
What would I do Min or Max on? Im not sorting them, Im just concatenating them with commas.
Jul 22 '09 #5
ck9663
2,878 Expert 2GB
You might want to try it first...

Here, read this


Good luck!!!

--- CK
Jul 22 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Gary Richardson | last post by:
I would like to define a new cursor for use on a Canvas (other than one of those listed in Appendix F of "Python and Tkinter Programming"). A search on Google turned up one bit of code that seemed...
7
by: Brian Kelley | last post by:
I am trying to use threads and mysqldb to retrieve data from multiple asynchronous queries. My basic strategy is as follows, create two cursors, attach them to the appropriate databases and then...
3
by: Fabri | last post by:
Do you know please why in Firefox there is this strange behavior? This work: --> <img src="mickey.jpg" width="200" height="150" onMouseOver="document.body.style.cursor ='move';"> But if...
2
by: Kamran | last post by:
Hi I have very little experience of C++, nevertheless I have been asked to write a gui using QT/QWT. I know that I should direct the question to the relevant mailing list and I have done that but...
11
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
3
by: mathilda | last post by:
When I'm opening a recordset for add new, is it faster to put a limiting clause on it? i.e. does "Select from Where Keyfield = " & value & " return a recordset faster than "Select ...
2
by: dave | last post by:
In my form Ive got a SaveData() routine that saves changes to a DB. When I encounter an exception in the save operations, I am having trouble chaning the cursor back to the default cursor, it just...
10
by: Franky | last post by:
I think I misread a post and understood that if I do: System.Windows.Forms.Cursor.Current = Cursors.WaitCursor there is no need to reset the cursor to Default. So I made all the reset...
6
by: Jorgen Bodde | last post by:
Hi all, I am using sqlite3 in python, and I wonder if there is a way to know if there are valid rows returned or not. For example I have a table song with one entry in it. The ID of that entry...
7
by: jackwootton | last post by:
Hello, I have a textarea (a very small one). I register a keydown event listener on the textarea. In the function which handles the event, I have the following line of code: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.