Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is this doable in sql procedure?

Status
Not open for further replies.

RestonDeveloper

Programmer
Aug 1, 2007
23
US
Have a table of course/course activity calendar events.
I want to combine records that are the same date, same course into one calander entry.

example

would turn this set
course, date, activity, description, starttime, endtime
science,'11/28/2007', 'lab', 'disect frog', '12:00:00', '14:00:00'
science,'11/28/2007', 'lecture', 'how heart beats', '15:00:00', '17:00:00'

into
course, date, activity, description, starttime, endtime
science,'11/28/2007', 'combined', '<P>lab: disect frog<br>12:00:00-14:00:00</P><P>lecture: how heart beats<br>15:00:00-17:00:00</P>', '12:00:00', '17:00:00'

the way i am going about it now is C# reading in this sql statement: SELECT COUNT(*) AS COUNT, CourseId, [Day], [Month], [Year] FROM tblCalendarFirm_Mediator GROUP BY CourseId, [Day], [Month], [Year] HAVING COUNT(*) > 1

then i loop through data set creating a seperate dataset for having the columns defined above and and making one insert statement, run statement, then delete ids found in record set.

am i making sense? and was this right approach or should this all be contained in a sql procedure, or two.

 
will they always be only lab and lecture?

"NOTHING is more important in a database than integrity." ESquared
 
no, that was just example. these courses aren't college or science courses.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top