sql - Getting new coordinates based on merged table number -


There are two tables that have a base table with 'table information' for a visitor center and others include 'business information'.

The basic coordinates (X, Y) recorded for each table in the base table structure are however, during businesses, a table or two can be merged with the other. In such cases, I want to get a separate table list with new coordinates. Base table coordinates can not be changed or updated.

In some way I am not going to the results yet, you can see that the table 7 and 9 are merged. 7 has been merged with 9 main table and both the coordinates of Table 7 and 99 should be.

  TABLE_NUMBER T_TABLE TABLE_TYPE LOCATION_X LOCATION_Y 1 (zero) rectangular 49 74 2 (zero) rectangular 68 101 3 3 rectangular 49 107 4 4 rectangular 24 80 5 (zero) rectangular 82 80 6 6 Round 29 197 (empty) round 1398 8 round 66 109 9 round 112 1697 round 112 16 Expected results:  
  TABLE_NUMBER TABLE_TYPE LOCATION_X LOCATION_Y 1 rectangular 49 74 2 rectangle 68 101 3 rectangular 49 107 4 rectangular 24 80 5 rectangular 82 80 6 round 29 19 7 round 112 16 8 round 66 10 9 round 112 16  
< H2> Here it is.

Hope this works

Script: ..

 ; As cte_temp with (choose TT.TABLE_NUMBER, TC.TABLE_NUMBER T_TABLE, TT [TABLE_TYPE], TT [LOCATION_X], TT. [LOCATION_Y] from [tables] TT LEFT JOIN [business] TC on (TT. [TABLE_NUMBER] = case when TC. [MAIN_TABLE_NUMBER] = 0 then TC.TABLE_NUMBER otherwise TC.MAIN_TABLE_NUMBER end)) differs select a .TABLE_NUMBER, a.TABLE_TYPE, the case when a.T_TABLE zero and when a.T_TABLE zero and B.T_TABLE not NULL then b.T_TABLE not NULL then b.LOCATION_X otherwise a.LOCATION_X end LOCATION_X, the case is like.  
as a.TABLE_NUMBER = b.T_TABLE on the left as a.LOCATION_Y as a cease_temp as LOCATION.Y.

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -