Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query works on Access Database but not work in node-adodb #462

Open
frmichetti opened this issue Nov 16, 2021 · 2 comments
Open

Query works on Access Database but not work in node-adodb #462

frmichetti opened this issue Nov 16, 2021 · 2 comments

Comments

@frmichetti
Copy link

I have a query nested inside my database working perfectly. When I try to run on node-adodb it doesn't return any results and also doesn't show any error.

Query source table [All Games List API]:
SELECT * FROM (SELECT [Origin Games].idx AS idx,[Origin Games].title AS title, "Origin" AS system, CBOOL([Origin Games].finished) AS finished FROM [Origin Games] UNION SELECT [Steam Games].[appid] AS appid, [Steam Games].[title] AS title, "Steam" AS system, CBOOL([Steam Finished].finished) AS finished FROM [Steam Games] INNER JOIN [Steam Finished] ON [Steam Games].[appid] = [Steam Finished].[appid] UNION SELECT [Wii GC Games].idx AS idx,[Wii GC Games].title AS title, [Wii GC Games].iso_type AS system, CBOOL([Wii GC Games].finished) AS finished FROM [Wii GC Games] UNION SELECT [WiiU Games].idx AS idx, [WiiU Games].title AS title, "WiiU" AS system, CBOOL([WiiU Games].finished) AS finished FROM [WiiU Games] UNION SELECT [Ubisoft Games].idx AS idx, [Ubisoft Games].title AS title, "Ubisoft" AS system, CBOOL([Ubisoft Games].finished) AS finished FROM [Ubisoft Games] ) AS ALL_GAMES ORDER BY ALL_GAMES.title, ALL_GAMES.system;
This query works perfectly.

Now when I try to run the following query in ado-db:

SELECT * FROM [All Games List API] WHERE title Like "*Assa*";
No error is returned and no data is returned. But when executing this query inside the database it works normally.

@frmichetti
Copy link
Author

Today I did a test, I renamed the table names replacing spaces with underline. Even so the query doesn't return data.

@dlh2
Copy link

dlh2 commented Jan 12, 2022

Hi, I think what you need is parenthesis on the FROM part and also by each UNION part.

Take this Query as an example:

SELECT a.animal, p.name, v.name
FROM (animals a INNER JOIN person p ON a.owner=p.id)
INNER JOIN  vets v ON a.vet = v.id 

Note: I don't know why Access does need this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants