Jump to content

Inner Joins


Recommended Posts

Hello All -

I am new to SQL joins and I am having a difficulty grabbing data from another table.

The table I am primarily running select statements on to output the information I need is HRO. I am wanting to grab some data from the StoreInfo table, but, I cannot seem to get the INNER JOIN function to work. I get this "the multiplier identifier could not be bound."

What am I doing wrong? Please see the code below.

use ROWDW;


store_UIN.HRO, store_UIN.StoreInfo
FORMAT(SUM(total-tax), 'C', 'en-us') AS 'Sales ending 02/06/2016',
COUNT(RO_NO) as 'Car Count',
FORMAT(((SUM((total-tax-t_cost)-(p_cost-supplies))/SUM(total-tax-supplies))), 'P', 'en-us' ) as GPM

from HRO 
inner join StoreInfo 
on store_UIN.HRO = store_UIN.StoreInfo

( PAY_DATE >= '01/31/2016') And (PAY_DATE <= '02/06/2016') and [Status] = 'C'  

group by store_UIN

Thanks in advance for your help.

Link to comment
Share on other sites

When you join two tables, the ON clause must associate a field of one table to a field of the other table. Currently you're associating two fields from the same table. You also are only selecting fields from one of the tables and not the other.


Here's an example of how to properly do a join

FROM table1
  ON table1.id = table2.id
WHERE table1.field < 10
  • Like 1
Link to comment
Share on other sites

  • 3 years later...

You have a select only one table from fetch data in your query. Join the two table using sql query you need to on clause after matching id from both table

select table1.column1, table1.column2, table2.column1....

from table 1

Inner join table 2

On table 1.matching_column = table 2.matching_column

where table1.column2 < 10


Edited by Sherin
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...