imelendez Posted February 14, 2016 Share Posted February 14, 2016 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; select 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 where ( 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 More sharing options...
Ingolme Posted February 14, 2016 Share Posted February 14, 2016 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 SELECT table1.field, table2.otherfield FROM table1 INNER JOIN table2 ON table1.id = table2.id WHERE table1.field < 10 1 Link to comment Share on other sites More sharing options...
imelendez Posted February 15, 2016 Author Share Posted February 15, 2016 Thank you, Foxy Mod. That helped and worked! Link to comment Share on other sites More sharing options...
Sherin Posted January 22, 2020 Share Posted January 22, 2020 (edited) 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 January 22, 2020 by Sherin Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now