View Single Post
  #117 (permalink)  
Old 03-04-10, 13:08
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Talking Sudoku level-4

Sudoku level-4 < 3 sec >:

Code:
select max(sd_id) from final table
(insert into Sd_Source  
select ifnull(max(sd_id), 0) + 1, 1, '000204900'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())       
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 2, '000000030'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 3, '100609005'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all 
select ifnull(max(sd_id), 0) + 1, 4, '056000082'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 5, '000000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 6, '030000170'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 7, '800502007'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 8, '060000000'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
union all
select ifnull(max(sd_id), 0) + 1, 9, '705900800'
     , ifnull(max(sd_id), 0) + 1, timestamp(generate_unique())
  from Sd_Source 
);
Quote:
Line 1: | 6 | 7 | 3 | 2 | 5 | 4 | 9 | 1 | 8 |
Line 2: | 5 | 9 | 2 | 1 | 8 | 7 | 6 | 3 | 4 |
Line 3: | 1 | 8 | 4 | 6 | 3 | 9 | 7 | 2 | 5 |
Line 4: | 9 | 5 | 6 | 3 | 7 | 1 | 4 | 8 | 2 |
Line 5: | 4 | 1 | 7 | 8 | 2 | 6 | 5 | 9 | 3 |
Line 6: | 2 | 3 | 8 | 4 | 9 | 5 | 1 | 7 | 6 |
Line 7: | 8 | 4 | 9 | 5 | 1 | 2 | 3 | 6 | 7 |
Line 8: | 3 | 6 | 1 | 7 | 4 | 8 | 2 | 5 | 9 |
Line 9: | 7 | 2 | 5 | 9 | 6 | 3 | 8 | 4 | 1 |
Lenny
Reply With Quote