Wednesday 15 January 2014

database - I NEED HELP WRITING T SQL -


Someone can write me a question that will loop through a table and the results will be as shown below in a temporary table :

  lvl state program code AY4045 BI 4045 EY4045 FY4045IY4045MY4045PY4045RY4045TY4045  

Output

  Program Code State AEMT4053WI - X - --X  

you have your table Switch to data pivoting want to do do not need to loop through the table. A simple group can move with case details if you understand the original T-SQL, then you will start the questions below. Select [] [program code], [state], [a] = maximum (case [lvl] = 'a' ('x' and '' idd), [b] = Max (in case [LVL] = 'B' then 'X' and '' end), [E] = Max (in case [LVL] = 'E' [program code], [state]

and here


No comments:

Post a Comment