1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2008
    Rep Power

    Arrow 'Partition By' Issue

    Hello all,

    I have written the following query, but I get an error message:

    SELECT [VisitorID], Products AS 'Recommended 2', ROW_NUMBER() OVER (PARTITION BY [VisitorID] ORDER BY [VisitorID] ASC) AS tR
     FROM (
    SELECT pv.[VisitorID], pv.[Products]
      FROM C1016473.[Omniture Views Recomms Auxiliary] pv INNER JOIN C1016473.[Argos Product Catalogue In-Stock] prod ON pv.Products = prod.[Product ID] ) foo
    WHERE foo.tR <= 3
    The error message is:

    Msg 207, Level 16, State 1, Line 1
    Invalid column name 'tR'.

    I am not able to debug the query; any assistance will be highly appreciated!

    Many thanks!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2007
    Rep Power
    The tR column does not exists in your foo table
    Repeat the row_number function in your where clause

    Comments on this post

    • Vomster agrees

IMN logo majestic logo threadwatch logo seochat tools logo