Code Monkey home page Code Monkey logo

Comments (5)

demmings avatar demmings commented on July 20, 2024

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.

sentolga avatar sentolga commented on July 20, 2024

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.

demmings avatar demmings commented on July 20, 2024

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.

demmings avatar demmings commented on July 20, 2024

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.

sentolga avatar sentolga commented on July 20, 2024

Thank you so much fo your effort !

from gssql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.