join tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sacramentomonteiro
    New Member
    • Oct 2007
    • 1

    #1

    join tables

    Hello,

    I need to join two table in the same databases, but I have one error.

    this is my script:

    select game.yr, city.name
    from game join city
    on(game.city = city.name)

    this is the error:

    Msg 402, Level 16, State 1, Line 2
    The data types text and text are incompatible in the equal to operator.

    Someone can help me, thank's.
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by Sacramentomonte iro
    Hello,

    I need to join two table in the same databases, but I have one error.

    this is my script:

    select game.yr, city.name
    from game join city
    on(game.city = city.name)

    this is the error:

    Msg 402, Level 16, State 1, Line 2
    The data types text and text are incompatible in the equal to operator.

    Someone can help me, thank's.
    assuming the two structure can be explicitly converted into the same type...

    try:
    Code:
    select game.yr, city.name
    from game inner/left/right join city on game.city = city.name
    depending on your requirement, use either inner, left or right

    Comment

    Working...