Difference between revisions of "Technical Notes"

From Kbwiki
Jump to: navigation, search
(New page: *Query to find unmatched trap_id's: SELECT trap_routes.trap_id, trap.trap_id FROM trap_routes LEFT JOIN trap ON trap_routes.trap_id = trap.trap_id WHERE trap.trap_ID IS NULL)
 
Line 1: Line 1:
*Query to find unmatched trap_id's:
+
*Query to find unmatched <b>trap_id</b>'s:
 
  SELECT trap_routes.trap_id, trap.trap_id
 
  SELECT trap_routes.trap_id, trap.trap_id
 
  FROM trap_routes
 
  FROM trap_routes
 
  LEFT JOIN trap ON trap_routes.trap_id = trap.trap_id
 
  LEFT JOIN trap ON trap_routes.trap_id = trap.trap_id
 
  WHERE trap.trap_ID IS NULL
 
  WHERE trap.trap_ID IS NULL
 +
 +
* Query to update <b>trap</b> table using values from <b>trap_routes</b> table:
 +
UPDATE trap, trap_routes
 +
SET trap.trap_route=trap_routes.trap_id, trap.trap_route_sequence=trap_routes.trap_route_sequence
 +
WHERE trap_routes.trap_id=trap.trap_id

Revision as of 12:29, 16 January 2008

  • Query to find unmatched trap_id's:
SELECT trap_routes.trap_id, trap.trap_id
FROM trap_routes
LEFT JOIN trap ON trap_routes.trap_id = trap.trap_id
WHERE trap.trap_ID IS NULL
  • Query to update trap table using values from trap_routes table:
UPDATE trap, trap_routes
SET trap.trap_route=trap_routes.trap_id, trap.trap_route_sequence=trap_routes.trap_route_sequence
WHERE trap_routes.trap_id=trap.trap_id