473,410 Members | 1,916 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,410 software developers and data experts.

Concatenating Certain Rows in Table

I am trying to Concatene certain rows in a table but not all for instance

I have a Course Track that consits of the classes

Expand|Select|Wrap|Line Numbers
  1. CourseName          Progressionorder
  2. Class 1                          1
  3. Class 2                          2
  4. Class 3-A                        3
  5. Class 3-B                        3
  6. Class 3-C                        3
  7. Class 4-A                        4
  8. Class 4-B                        4
  9.  
  10.  
I want to have a select statement in which will return

Expand|Select|Wrap|Line Numbers
  1. Class 1
  2. Class 2
  3. Class 3-A, Class 3-B, Class 3-C 
  4. Class 4-A, Class 4-B
  5.  
  6.  
The rows that should be concatenated are the rows with the same progression order.

Thank You in advance
May 19 '08 #1
1 939
ck9663
2,878 Expert 2GB
I am trying to Concatene certain rows in a table but not all for instance

I have a Course Track that consits of the classes

Expand|Select|Wrap|Line Numbers
  1. CourseName          Progressionorder
  2. Class 1                          1
  3. Class 2                          2
  4. Class 3-A                        3
  5. Class 3-B                        3
  6. Class 3-C                        3
  7. Class 4-A                        4
  8. Class 4-B                        4
  9.  
  10.  
I want to have a select statement in which will return

Expand|Select|Wrap|Line Numbers
  1. Class 1
  2. Class 2
  3. Class 3-A, Class 3-B, Class 3-C 
  4. Class 4-A, Class 4-B
  5.  
  6.  
The rows that should be concatenated are the rows with the same progression order.

Thank You in advance
I'll try to write your code later. You will need to be in sql2005. But here's the algorithm: Un/Pivot your table where the count of Progressionorder > 1. Union it with those with Progressionorder = 1.

-- CK
May 19 '08 #2

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

Similar topics

20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
16
by: Dixie | last post by:
I have a problem using Dev Ashish's excellent module to concatenate the results of a field from several records into one record. I am using the code to concatenate certain awards onto a...
2
by: scott | last post by:
Hi all, Iv got a slight problem with a datagrid and the ability to only display certain things in it. I have a Data grid which is connected to a data table. The data table is connected...
6
by: Hennie7863 | last post by:
Hi, I have table which has the following values : ID SEQ Text 1 1 A 2 1 B 3 2 C 4 2 D 5 2 E
3
by: bhaalsen | last post by:
Hi there! I got a slight problem with a web application, its supposed to several entries for a certain ID, and display them as one string. Example: ID | Name ------------- 1 | Jack
4
by: James Conrad StJohn Foreman | last post by:
I've got a table full of search terms, one search term per row. ID CATEGORYID SEARCH_TERM 1 1 cat 2 1 mat 3 2 sat .... I need to get the search terms concatenated - is there an...
7
by: Mary | last post by:
I have a student who has a hyphenated first name. If I concatenate the name like this: StudentName:( & ", " & ), it works as expected. If, however, I try to get the first name first by...
1
by: plumba | last post by:
Hi all. I have a form which has a table and within the rows of the table are simple text input boxes. The ONLY problems with this is that when the form is posted (in text format) if the number of...
0
by: jehrich | last post by:
Hi Everyone, I am a bit of a hobby programmer (read newbie), and I have been searching for a solution to a SQL problem for a recent pet project. I discovered that there are a number of brilliant...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.