SQL Query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jenny

    #1

    SQL Query

    hi, could someone please tell me how do I get a query to show the (*) fields
    in table2 only when table2.field1 exist in table1.field1

    thanks in advance.
    jenny


    table 1 contains
    --------------------------
    field1
    1
    5
    4
    9


    table 2 contains
    --------------------------------

    field1 field2
    1 a
    1 b
    1 j
    1 m
    2 a
    2 b
    3 a
    3 n
    4 c
    4 d


    --------------
    desired results:
    ---------------

    table2.field1 table2.field2
    1 a
    1 b
    1 j
    1 m
    4 c
    4 d






  • Aggro

    #2
    Re: SQL Query

    Jenny wrote:[color=blue]
    > hi, could someone please tell me how do I get a query to show the (*) fields
    > in table2 only when table2.field1 exist in table1.field1[/color]

    select table2.* from table2,table1
    where table2.field1=t able1.field1;

    Comment

    • Jenny

      #3
      Re: SQL Query

      thank you for the assist.
      jenny



      "Aggro" <spammerdream@y ahoo.com> wrote in message
      news:GIzHd.513$ vl1.490@read3.i net.fi...[color=blue]
      > Jenny wrote:[color=green]
      > > hi, could someone please tell me how do I get a query to show the (*)[/color][/color]
      fields[color=blue][color=green]
      > > in table2 only when table2.field1 exist in table1.field1[/color]
      >
      > select table2.* from table2,table1
      > where table2.field1=t able1.field1;[/color]


      Comment

      Working...