select

  • SELECT

    p.rate,

    p.map,

    st.case,

    TOP T.Pay ??????????

    FROM payroll p

    inner join students st on st.pay= p.payID

    WHERE p.map=@callno AND

    st.rate= @PayID

    GO

    from the above select , how can I get TOP 1 at T.pay. I mean I need only 1st record from the T.Pay.

  • If you post your table def it will be helpful

  • Absolutely - along with some sample data as well...

    but to simply select the top 1 row from a table (if that's what the query is actually about) then the syntax is just as simple...

    select top 1 rate, map, case, pay from.....







    **ASCII stupid question, get a stupid ANSI !!!**

  • Back from retirement Sue???

  • From your question, I am assuming Pay is in a different table so without knowing the structure I would say you can get Top pay by subselect as well.

    SELECT

    p.rate,

    p.map,

    st.case,

    (select TOP T.Pay from.....) as Pay

    FROM payroll p

    inner join students st on st.pay= p.payID

    WHERE p.map=@callno AND

    st.rate= @PayID

    GO

    Thanks

    Sreejith

  • Not at all Remi - was just "passing by" on my way to the "retired people book club meeting"..

    But since YOU seem to be "back" here's a post I came across that seems to be challenging your great mind in particular...I couldn't comprehend the logic...I'm sure you can...







    **ASCII stupid question, get a stupid ANSI !!!**

Viewing 6 posts - 1 through 5 (of 5 total)

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