Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

SQL caclcualted field

Question posted by: alangrn26 (Newbie) on July 2nd, 2008 04:55 PM
How do I create the SQL for the following. I have a table of meetings, but I want to generate a calculated field for each discussion point relating to that meeting. i.e. the forth column in the table below is to be calculated based on the Meeting number.

MeetingID Meeting Discussion Point Calculated field
1 1 Text1 Discussion Point 1
2 1 Text2 Discussion Point 2
3 2 Text3 Discussion Point 1
4 2 Text4 Discussion Point 2
5 3 Text5 Discussion Point 1
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Delerna's Avatar
Delerna
Expert
544 Posts
July 4th, 2008
04:13 AM
#2

Re: SQL caclcualted field
Code: ( text )
  1. select MeetingID,Meeting,DiscussionPoint,
  2.        (   Select Count(MeetingID)
  3.            from YourTable b
  4.            where b.Meeting=a.Meeting
  5.              and b.MeetingID<=a.MeetingID
  6.        ) as CalculatedField
  7. From YourTable a

Reply
Reply
Not the answer you were looking for? Post your question . . .
183,969 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top Microsoft SQL Server Contributors