r/DatabaseHelp • u/ShenanigansPara • Mar 10 '20
Database Query not posting any data.
So I have a complicated (to me) Database that was created by someone else many years ago.
This Database has a Query that creates a Table (QryMakeChemTable) . Using 2 individual Tables (ChemInfo and Chems).
Then another Query (EPCRA List) is run using the Following Tables;
(New Sara List, ChemTable).
The New Sara List Table is that is populated with Data.
When I run the following Query (ECPRA) to get my end results it comes up with the headers of the columns but, shows No data.
SELECT [New Sara list].[Section 302 EHS TPQ], [New Sara list].[Section 304 EHS RQ], [New Sara list].[Section 313], [New Sara list].[CERCLA RQ], ChemTable.[CAS #], ChemTable.[Container Size], ChemTable.[Container Unit], ChemTable.[Chemical Name], ChemTable.[Barcode #]
FROM ChemTable INNER JOIN [New Sara list] ON ChemTable.[CAS #] = [New Sara list].[CAS Sort Value]
ORDER BY ChemTable.[Barcode #];
Any idea of a direction to go to to Troubleshoot this?
Thank you in advance.
2
u/wolf2600 Mar 10 '20 edited Mar 10 '20
Formatting:
If you do a
select * from chemtable;do you get results?What about
select * from [New Sara list];?By the way, [New Sara list] is a HORRIBLE name for a table.... I'd suggest when creating tables/columns, NEVER use the square brackets or double quotes. That way you can't use spaces and the names are case-insensitive.
You could also do:
And compare the values listed to the results of this query:
Do values from the first list appear in the second list?
1
u/ShenanigansPara Mar 10 '20
ChemTable does have Data. When the QryMakeChemTable is run it populates data from (ChemInfo and Chems) Tables.
The Query at the end (ECPRA) is the one that will not populate any data. It shows the column headers but no data is coming through.
1
u/ShenanigansPara Mar 10 '20
Thank you Wolf. I will give that a try and see if it works.
1
u/ShenanigansPara Mar 10 '20
I was able to simplify just the Select From ChemTable and it showed the results of the two columns. I tried it with the Sara List and it through an error. I believe I have some syntax wrong. Thank you for the assistance. I will post again in the morning and let you know what I find.
2
u/chrwei Mar 10 '20
so basically ChemTable has no data that matches the other table? you need to diagnose the first part of what you said