473,468 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how can get below output?

37 New Member
Hi,

I have a table student having two columns name and course-Id, if one student having more then one course-Id.
Ex:
name course-Id
venu c
venu c++
venu v.B

then i need a o/p as
name course-ID
venu c,c++,V.B

Thanks in Advance,
Vasavivenu.
Jul 19 '11 #1
4 1542
Rabbit
12,516 Recognized Expert Moderator MVP
You'll have to use a cursor so that you can concatenate all the course IDs together.
Jul 19 '11 #2
ck9663
2,878 Recognized Expert Specialist
Here, try to tweak this...

Happy Coding!!!

~~ CK
Jul 19 '11 #3
vasavivenu
37 New Member
I find my self as

SELECT name,
MAX( CASE no WHEN 1 THEN no ELSE '' END ) + ', ' +
MAX( CASE no WHEN 2 THEN no ELSE '' END ) + ', ' +
MAX( CASE no WHEN 3 THEN no ELSE '' END )

FROM venus
GROUP BY name ;
Jul 20 '11 #4
Rabbit
12,516 Recognized Expert Moderator MVP
That will work if a student has no more than 3 classes. If they take more or a future student ends up taking more, it will not work.
Jul 20 '11 #5

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

Similar topics

2
by: Bob | last post by:
Everybody, I've been doing a lot of on-line research and cannot find any reference to the exact problem I'm having. Let me preface this question with the fact that I'm coming from an Oracle...
0
by: reneecccwest | last post by:
Hello, I have three tables and would like to see the output result as below: --------------------- OUTPUT RESULT -------------------------------------- index_id ...
0
by: reneecccwest | last post by:
Hello, I have three tables and would like to see the output result as below: --------------------- OUTPUT RESULT -------------------------------------- index_id ...
1
by: Michael Kragh Pedersen | last post by:
I have made an XSLT document, looking like this. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes" method="text"/> <xsl:template...
6
by: Wescotte | last post by:
I'm writing a tiny php app that will log into our bank of america account and retrieve a file containing a list of checks that cleared the previous day. The problem I'm running into is when I...
3
by: Jorge Cecílio | last post by:
Hi! I would like to export some MS-Access reports output to pdf. However, the only possibility offered by Access (afaik) for me to export formatted output is snp (snapshot) (I use MS-Office...
4
by: Michael Maes | last post by:
Hello, I want to add a date (ShortDateString) to a custom template-file (Class). I use: a.. b.. c.. But I can't find anythig on a date (something like: )
8
by: TGEAR | last post by:
I have an ItemSTDPriceHistory table as below and this is a child table of itemlookup table with one to many relationship. if exists (select * from dbo.sysobjects where id = object_id(N'.') and...
1
by: dwaterpolo | last post by:
Hi Everyone, I am trying to read two text files swY40p10t3ctw45.col.txt and solution.txt and compare them, the first text file has a bunch of values listed like: y y y y y y y
2
by: Mark B | last post by:
What amendments to the ASP.NET 3.5. VB code below output the MSSQL stored procedure dataset result to XML (as a response stream)? (I also guessing to use Response.ContentType = "text/xml"): ...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.