Statment Issue

  • Msg 102, Level 15, State 1, Line 6

    Incorrect syntax near 'payment'.

    Select

    payvoucher.claimid,

    paycheck.checknbr,

    paycheck.checkamt,

    (

    MAX(paydate) payment.paydate FROM payment group by paydate

    )

    payment.payee

    From

    payvoucher Inner Join

    paycheck

    On paycheck.paymentid = payvoucher.paymentid Inner Join

    payment

    On payvoucher.paymentid = payment.paymentid And paycheck.paymentid =

    payment.paymentid

    Where

    --CONVERT max(date,payment.paydate) = (select CONVERT(date, max(createdate)) from payment group by paydate) and

    paycheck.checknbr not in ('NULL',' ')

    Order By

    paycheck.checkamt

  • Missing comma after subquery and the subquery doesnt have a SELECT clause.

    SELECT

    fld1

    ,fld2

    ,(SELECT max(something) from dbo.somewhere) as MaxOfSomething

    ,fld3

    FROM dbo.SomewhereElse

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply