• nuchbcc (8/13/2013)


    I tried the JOIN query separately and received the output that I needed but when I added it to the existing query, it failed.

    I guess what I'm trying to ask is do I need to setup PK and FK? If yes do I create the FK from table1, set the PK table to be table2 pointing to StatusName column and FK table to be table1 pointing to StatusID column?

    Thank You

    No you are not required to establish a foreign key relationship between these tables. However if you do you would NOT have be on the StatusName column it would be on the value column.

    _______________________________________________________________

    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/