Giter Club home page Giter Club logo

Comments (4)

rbock avatar rbock commented on July 30, 2024 1

Thanks for the report and for figuring out a first solution.

select requires a where clause or an explicit hint that this is an unconditional request by calling .unconditionally(). This is to prevent folks to accidentally forget the where clause. And you should have seen a static assert saying calling where() or unconditionally() required.

So in your example, this would be written as

auto query = sqlpp::select(A.field, sqlpp::count(B.aId))
		.from(B.join(A).on(B.aId == A.id))
		.unconditionally()
		.group_by(A.field)
		;

I noticed that unconditionally is not documented in the /docs. Fixed that.

Thanks,
Roland

from sqlpp11.

v-val avatar v-val commented on July 30, 2024

I was able to get it in a bit dodgy way:

auto query = sqlpp::select(A.field, sqlpp::count(B.aId))
                .where(A.field.is_not_null())        // This helped, not sure why.
		.from(B.join(A).on(B.aId == A.id))
		.group_by(A.field)
		;

Seems .where(...) is needed, although .where(true) I tried first didn't work.
It would be great if this could be clarified.

from sqlpp11.

v-instrumentix avatar v-instrumentix commented on July 30, 2024

Thanks a lot for the quick answer and for clarification.
Regards!

from sqlpp11.

rbock avatar rbock commented on July 30, 2024

Thanks for the confirmation.

from sqlpp11.

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.