SQL caclcualted field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alangrn26
    New Member
    • Jul 2008
    • 1

    SQL caclcualted field

    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
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    [code=sql]
    select MeetingID,Meeti ng,DiscussionPo int,
    ( Select Count(MeetingID )
    from YourTable b
    where b.Meeting=a.Mee ting
    and b.MeetingID<=a. MeetingID
    ) as CalculatedField
    From YourTable a
    [/code]

    Comment

    Working...