Learner
Learner

Reputation: 990

Sybase : Updating a table with Top keyword

Update 
  Table1 
set 
  name = (select top 1 a.col 
          from Table2 a 
          where Table1.num = a.num)

This seems to work in Sql Server but get an error message in Sybase saying Incorrect syntax near keyword 'top'.

Can some one find out what's the problem?

Upvotes: 0

Views: 1476

Answers (1)

ypercubeᵀᴹ
ypercubeᵀᴹ

Reputation: 115600

Does this work for you?:

UPDATE Table1 
SET name = 
    ( SELECT MIN(a.col) 
      FROM Table2 a 
      WHERE Table1.num = a.num
    )

Upvotes: 1

Related Questions