Comments (5)
My field alias in the select is only used for display in column titles and so can't be used in calculated fields. I don't think that mySQL allows for this syntax either. I would try using a sub-query for this field (which is supported). You could also try to just use (count(d.device_id) - min(a.number_of_active_devices) ) as sss
See issue #11
from gssql.
Thank you for getting back. Really appreciate it.
Your GS example works fine but it doesn't work on my file :
"Select d.account_name, d.account_id,count(d.device_id) as devicetotal,a.account_name,a.account_id,min(a.number_of_active_devices) as accounttotal, (count(d.device_id) - min(a.number_of_active_devices)) as sss
from d full join a on d.account_id=a.account_id group by d.account_name, d.account_id,a.account_name,a.account_id"
it gives the following error
Error: Invalid select field: (count(d.device_id) - min(a.number_of_active_devices)) (line 2835).
from gssql.
sentolga,
In my testing I have found several issues in and around JOIN and GROUP BY. For now doing a calculation on a aggregate field in a GROUP BY is failing. See: #54 , #55 and #56
from gssql.
Original issue raised was not being able to use a field alias in a calculation. This is not support in gsSQL() (or in mySQL as well). However, in this case, the fix should have been doing a calculated field that involved two aggregate functions in a GROUP BY statement. This calculation was not supported at that time. Now a basic calculation using aggregate fields are supported.
from gssql.
Thank you so much fo your effort !
from gssql.
Related Issues (20)
- GROUP BY with Calculated Field Fails.
- select ORDER BY expression
- Sonarcloud and REGEX use.
- Misleading error message for invalid ORDER BY
- Where LIKE is not filtering properly.
- Select FROM sub-query that uses LIKE may fail.
- Select from SUB-QUERY and no table alias.
- SQL function parameter with quoted comma.
- dateDiff() works in morning, not in afternoon.
- where NOT LIKE excluding some it shouldn't.
- NOT IN BUG HOT 5
- Multiple sets (UNION, UNION ALL, ...) are not resolved in correct order. HOT 2
- Sql Set (union, union all,...) in subquery fails. HOT 2
- library id not working HOT 1
- JOIN ON is case sensitive. HOT 1
- COUNT(field) when NULL is incorrect. HOT 1
- Aggregate Calculated field within SELECT fields with GROUP BY failing. HOT 1
- Error when CONCAT_WS() receives MONTH() as param HOT 2
- Date comparison not valid when NON DATE characters are in column. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gssql.