User Profile

Collapse

Profile Sidebar

Collapse
flumonion
flumonion
Last Activity: Mar 27 '08, 01:25 PM
Joined: Jan 30 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Hi CK,

    thanks for the advice.

    I ended up using a temp table to store the returned records and then a neat little trick i found to add a increment which is:

    declare @intCounter int
    set @intCounter = 0
    update #Temp
    SET @intCounter = rank = @intCounter + 1

    thanks again
    See more | Go to post

    Leave a comment:


  • hi there,

    i am not too sure about that for this reason:

    X Y rank
    -34.020559 18.348137 1
    -34.041561 18.369392 1452
    -34.035796 18.361704 2470

    if you look at the rank the second row has an id that is 1451 bigger that the previous id. The subqeury say "bring back a count of all ids that are less than or equal to the current id"

    Am i mistaken?...
    See more | Go to post

    Leave a comment:


  • flumonion
    started a topic Create a dynamically incremented field

    Create a dynamically incremented field

    Hi,

    Does anyone know how i could add a incrementing field to a select statement.

    at the moment i have the following:

    SELECT X,Y,
    (SELECT COUNT(*)
    FROM dbo.tbldo e2
    WHERE e2.doid <= dbo.tblDO.doID) AS rank
    from dbo.tblDO INNER JOIN
    dbo.tblMA_XY ON dbo.tblDO.doID = dbo.tblMA_XY.do ID INNER JOIN
    dbo.tblMA_MA ON dbo.tblMA_XY.MA _MAIN_ID = dbo.tblMA_MA.MA _MAIN_ID...
    See more | Go to post

  • flumonion
    replied to update with a one to many
    Thank you deepuv04.

    That is what i was looking for.
    See more | Go to post

    Leave a comment:


  • flumonion
    started a topic update with a one to many

    update with a one to many

    Hi,

    I am trying to do the following

    update table A with the latest record from table B.

    TABLE A has
    PID (primary key)
    ID
    YEAR

    TABLE B is the same as above. There is a one to many relationship from A to B based on the ID.

    I ran the following update and it worked but it took the first record for each ID in TABLE B and updated that to TABLE A. Instead, i...
    See more | Go to post
No activity results to display
Show More
Working...