Skip to content
Advertisement

SELECT statement across multiple tables

First off, I am not an SQL coder.

I am trying to select information from 2 different tables in the same database.

Table 1 is called trans and has 3 columns:

Table 2 is called cust and has multiple columns:

The SELECT statement that I’m trying to write will pull data from both tables.

I THINK I need to use a JOIN statement, but I’m sure what kind of a JOIN or the proper syntax.

Thanks for your help!

Advertisement

Answer

You do need a JOIN. In fact, you should simply never write , in the FROM clause.

The JOIN you need would appear to be on the common column between the two tables:

In addition, you should understand that LIKE is a string function and 1234 is not a string. Presumably, you just want equality — so use =.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement