Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 1.46 KB  |  hits: 3  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Update Query in SQL with numeric pattern in MS Access
  2. ObjectID   R   C   DesiredResult
  3.  1            1 1   1
  4.  2            1 2   1
  5.  3            1 3   2
  6.  4            1 4   2
  7.  5            1 5   3
  8.  6            1 6   3
  9.  7            1 7   4
  10.  8            1 8   4
  11.  9            1 9   5
  12.  10           1 10  5
  13.  11           2 1   1
  14.  12           2 2   1
  15.  13           2 3   2
  16.  14           2 4   2
  17.  15           2 5   3
  18.  16           2 6   3
  19.  17           2 7   4
  20.  18           2 8   4
  21.  19           2 9   5
  22.  20           2 10  5
  23.  21           3 1   6
  24.  22           3 2   6
  25.  23           3 3   7
  26.  24           3 4   7
  27.  25           3 5   8
  28.  26           3 6   8
  29.  27           3 7   9
  30.  28           3 8   9
  31.  29           3 9   10
  32.  30           3 10  10
  33.  31           4 1   6
  34.  32           4 2   6
  35.  33           4 3   7
  36.  34           4 4   7
  37.  35           4 5   8
  38.  36           4 6   8
  39.  37           4 7   9
  40.  38           4 8   9
  41.  39           4 9   10
  42.  40           4 10  10
  43.  41           5 1   11
  44.  42           5 2   11
  45.  43           5 3   12
  46.  44           5 4   12
  47.  45           5 5   13
  48.  46           5 6   13
  49.  47           5 7   14
  50.  48           5 8   14
  51.  49           5 9   15
  52.  50           5 10  15
  53.        
  54. SELECT a.Row, a.Col, Col2 AS D1, Col Mod 2 AS D2, [D1]+[D2] AS Desired
  55. FROM  table  AS a
  56. ORDER BY a.Row, a.Col;
  57.        
  58. SELECT ObjectID, R, C,
  59.    Int(([C]-1)/2) AS ColIndex,
  60.    Int(([R]-1)/2) AS RowIndex,
  61.    [RowIndex]*5+[ColIndex]+1 AS DesiredResult
  62.  FROM Testing
  63.  ORDER BY ObjectID