Hi everyone after some research i don't really succeed to find an answer that fits my problem
Here is my problem, I have an SQL Query and i want to iterate on this one and the iteration concerns the change of one parameter in the query. Here is the basic query
select count(*)
from car_rent
inner join car on car_rent.car_id = car.id
where car_rent.created_at BETWEEN 2019-01-01 and 2019-01-31
and car.zipcode like '75%'
Now what i want is to iterate over this query, to get all the results, and replacing at each time the 75% parameter by an other one. I have to go from 01 to 95.
I looked on stack and found some stuff that could be interesting but i don't really find how to put my query on this on to obtain the result i'm expecting
Dept | Count(*)
01 | 9
02 | 14
03 | 2
04 | 18
....
This is the result i'm looking for =)
The other query i found it this one =>
SELECT
SEQ.SeqValue
FROM
(
SELECT
(HUNDREDS.SeqValue + TENS.SeqValue + ONES.SeqValue) SeqValue
FROM
(
SELECT 0 SeqValue
UNION ALL
SELECT 1 SeqValue
UNION ALL
SELECT 2 SeqValue
UNION ALL
SELECT 3 SeqValue
UNION ALL
SELECT 4 SeqValue
UNION ALL
SELECT 5 SeqValue
UNION ALL
SELECT 6 SeqValue
UNION ALL
SELECT 7 SeqValue
UNION ALL
SELECT 8 SeqValue
UNION ALL
SELECT 9 SeqValue
) ONES
CROSS JOIN
(
SELECT 0 SeqValue
UNION ALL
SELECT 10 SeqValue
UNION ALL
SELECT 20 SeqValue
UNION ALL
SELECT 30 SeqValue
UNION ALL
SELECT 40 SeqValue
UNION ALL
SELECT 50 SeqValue
UNION ALL
SELECT 60 SeqValue
UNION ALL
SELECT 70 SeqValue
UNION ALL
SELECT 80 SeqValue
UNION ALL
SELECT 90 SeqValue
) TENS
) SEQ
it provides me a result of 99 rows, but i don't really know how to combine my sql request with this one to obtain the result i want
If anyone could give me some hints, that would be really appreciate
Deptcolumn, and what is its relationship to the count? (there doesn't appear to be any relationship).