• ronan.healy (10/5/2012)


    hi i have 2 tables

    in 1 i have the following

    rateN1 rateN2 rateN3 rate

    a aa aaa 1

    b bb bbb 2

    c cc ccc 4

    d dd ddd 6

    table 2 has the following

    rateAge rateN rate y/n

    mood a 1 n

    fitch bb 2 y

    but i want it to be the 4 as thats the next number up from the 2 will that sql still work

    anyone any ideas how to do this

    Hi and welcome to SSC. From what you posted there is zero chance that anybody can help. There is nowhere near enough information. Can you post ddl (create table scripts), sample data (insert statements) and desired output based on your sample data? Take a look at the first link in my signature for best practices when posting questions.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/