-----------------------------------com.example.Example.java-----------------------------------
package com.example;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"0",
"1",
"2"
})
@Generated("jsonschema2pojo")
public class Example {
@JsonProperty("0")
public com.example._0 _0;
@JsonProperty("1")
public com.example._1 _1;
@JsonProperty("2")
public com.example._2 _2;
}
-----------------------------------com.example._0.java-----------------------------------
package com.example;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"created",
"suip",
"result",
"operationNumber"
})
@Generated("jsonschema2pojo")
public class _0 {
@JsonProperty("created")
public String created;
@JsonProperty("suip")
public String suip;
@JsonProperty("result")
public String result;
@JsonProperty("operationNumber")
public String operationNumber;
}
-----------------------------------com.example._1.java-----------------------------------
package com.example;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"created",
"suip",
"result",
"operationNumber"
})
@Generated("jsonschema2pojo")
public class _1 {
@JsonProperty("created")
public String created;
@JsonProperty("suip")
public String suip;
@JsonProperty("result")
public String result;
@JsonProperty("operationNumber")
public String operationNumber;
}
-----------------------------------com.example._2.java-----------------------------------
package com.example;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"created",
"suip",
"result",
"operationNumber"
})
@Generated("jsonschema2pojo")
public class _2 {
@JsonProperty("created")
public String created;
@JsonProperty("suip")
public String suip;
@JsonProperty("result")
public String result;
@JsonProperty("operationNumber")
public String operationNumber;
}
SELECT count(DISTINCT c.user_id) AS first_day_order
FROM clients c
INNER JOIN orders o ON c.user_id = o.user_id
WHERE DATE(c.registered_datetime) = DATE(o.when_start)
AND DATE(c.registered_datetime) BETWEEN '2021-09-01' AND '2021-09-30'
;
SELECT count(c.user_id) AS first_day_order
FROM clients c
WHERE DATE(c.registered_datetime) BETWEEN '2021-09-01' AND '2021-09-30'
AND EXISTS (
SELECT 1 FROM orders o
WHERE c.user_id = o.user_id
AND DATE(c.registered_datetime) = DATE(o.when_start)
)
;