Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Alternate to Like("")


Message #1 by "Michael Muffett" <mmuffett@h...> on Wed, 19 Feb 2003 15:34:25
Michael:

It sounds to me like you simply need an INNER JOIN query.  For instance, 
take the following two tables:

  MainTable
  ---------

      ID         President
      ---------  -----------------------
      0-9605568  Bill Clinton
      0-9704585  George Bush
      1-931452   George Washington
      1-56261    Thomas Jefferson
      1-56691    Hillary Clinton
      0-87930    John Adams

  ControlTable
  ------------

      LookMeUp
      --------
      0-9704585
      1-56691
      0-87930

Then use the following query:

  SELECT
    m.ID,
    m.President
  FROM MainTable m
  INNER JOIN ControlTable c
    ON m.ID = c.LookMeUp

This would yield the results:

      ID         President
      ---------  -----------------------
      0-9704585  George Bush
      1-56691    Hillary Clinton
      0-87930    John Adams

Cheers.

- Roger Nedel

  Nedel Software Solutions
  rnedel@n...


  Return to Index