Skip to content

Conversation

@umer-mehmood
Copy link
Contributor

No description provided.

@planetarydev
Copy link
Owner

Hello Umer,
thanks for this new helper. It looks good to me.
Please remove the lines that we dont need.

this.$expr = new SQLBuilder.SQLPredefined.StringValueParam(sql);
this.$format = new SQLBuilder.SQLPredefined.StringValueParam(sql);

You only need to to declare them if your syntax has used them like:

this.Types({
  String: { syntax: this.Syntax('DATE(<value-param>, $expr[, $format])') },
});

@umer-mehmood
Copy link
Contributor Author

umer-mehmood commented Nov 11, 2019 via email

@planetarydev
Copy link
Owner

THANKS!

@planetarydev planetarydev merged commit 9dc17d3 into planetarydev:master Nov 11, 2019
@umer-mehmood
Copy link
Contributor Author

umer-mehmood commented Nov 11, 2019 via email

@umer-mehmood
Copy link
Contributor Author

umer-mehmood commented Nov 11, 2019 via email

@planetarydev
Copy link
Owner

One thing ahead - please open an new issue for further questions. So anybody can find if he got the same problem/question.

Using the count-function inside the where clause will be a little bit tricky. You have to use the anyExpr helper and it works like this:

sql.build({
  $select: {
    $from: 'people',
    $where: {
      $and: [
        { $anyExpr: { $count: '*', $eq: 10 } }
      ]
    }
  }
});

https://github.com/planetarydev/json-sql-builder2/tree/master/sql/helpers/misc/anyExpr
Here you will find an example for the having clause.

Repository owner locked as off-topic and limited conversation to collaborators Nov 11, 2019
@planetarydev
Copy link
Owner

I have opened an new issue #26
Please have a look.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants