15,908,445 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Sarita B Patil (Top 5 by date)
Sarita B Patil
12-Mar-19 1:01am
View
I want to pass csv values to HTTP API as a parameter.
so can you help me, how to do this in c#
Sarita B Patil
2-Nov-18 1:17am
View
When I am converting image via the app, it gets uploaded in my another application. But when I am converting programmatically, it didn't get upload.
Can we find the version of tiff image file?
Sarita B Patil
1-Nov-18 4:36am
View
Try This
CREATE TABLE [dbo].[StudentMaster](
[StudentId] [numeric](18, 0) NOT NULL,
[StudentName] [varchar](50) NULL
) ON [PRIMARY]
GO
INSERT INTO StudentMaster(StudentID, StudentName) VALUES (1,'Garry')
INSERT INTO StudentMaster(StudentID, StudentName) VALUES (2,'Alex')
INSERT INTO StudentMaster(StudentID, StudentName) VALUES (3,'Sam')
INSERT INTO StudentMaster(StudentID, StudentName) VALUES (4,'Paul')
INSERT INTO StudentMaster(StudentID, StudentName) VALUES (5,'Ben')
SELECT * FROM StudentMaster
GO
CREATE TABLE [dbo].[Courses](
[CourseID] [int] NOT NULL,
[CourseName] [nvarchar](20) NULL,
PRIMARY KEY CLUSTERED
(
[CourseID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT INTO Courses(CourseId,CourseName) VALUES (1,'C#')
INSERT INTO Courses(CourseId,CourseName) VALUES (2,'ASP.Net')
INSERT INTO Courses(CourseId,CourseName) VALUES (3,'MVC')
INSERT INTO Courses(CourseId,CourseName) VALUES (4,'WCF')
INSERT INTO Courses(CourseId,CourseName) VALUES (5,'Share Point')
INSERT INTO Courses(CourseId,CourseName) VALUES (6,'WPF')
INSERT INTO Courses(CourseId,CourseName) VALUES (7,'SQL Server')
INSERT INTO Courses(CourseId,CourseName) VALUES (8,'JQuery')
SELECT * FROM Courses
GO
CREATE TABLE [dbo].[StudentCourses](
[StudentID] [int] NULL,
[CourseID] [int] NULL
) ON [PRIMARY]
GO
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (1,1)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (1,3)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (1,5)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (2,2)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (2,4)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (2,5)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (3,3)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (3,6)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (4,7)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (4,8)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (5,1)
INSERT INTO StudentCourses(StudentID, CourseID) VALUES (5,2)
SELECT * FROM StudentCourses
select t11.StudentID,StudentMaster.StudentName,t11.CourseNames from
(SELECT StudentID,
CourseNames=STUFF
(
(
SELECT DISTINCT ', '+ CAST(g.CourseName AS VARCHAR(MAX))
FROM Courses g,StudentCourses e
WHERE g.CourseID=e.CourseID and e.StudentID=t1.StudentID
FOR XMl PATH('')
),1,1,''
)
FROM StudentCourses t1
GROUP BY StudentID ) as t11
INNER JOIN StudentMaster ON StudentMaster.StudentID = t11.StudentID
Output will as follows : -
StudentID StudentName CourseNames
1 Garry C#, MVC, Share Point
2 Alex ASP.Net, Share Point, WCF
3 Sam MVC, WPF
4 Paul JQuery, SQL Server
5 Ben ASP.Net, C#
Sarita B Patil
31-Oct-18 1:04am
View
Because there is a problem in viewing image.
Sarita B Patil
31-Oct-18 1:00am
View
I want the code in the console application or web application using c#.