0
Good afternoon, personal my doubt and the following I have a database that lists me all the dates of delivery of works as follows
2016-07-13
2016-07-01
2016-03-09
2015-09-09
2013-03-06
how do I mount two selects that contain only table data
being the year
2016
2015
2014
and a month according to the selected year and only the month it contains in that year
When you say ride
select
refers to thatselect
of html?– rray
even added an image to clarify the question
– Cristiano Cardoso Silva
Cool, now the situation is clearer. It has several things to do, the route is, 1) make a select in the database just returning the data column use the function
year()
to extract the year remember to group, so you have the list of years with delivery. 2) With javascript make an ajax call ononchange()
of the year combo and send the value of the selected item. 3) this value goes in thewhere
(withyear()
) query takes the result of ajax and populate the month combo with the values.– rray
To take the month
SELECT to_char(dia, 'MM') FROM tabela WHERE to_char(dia, 'YYYY') = '2016' GROUP BY to_char(dia, 'MM')
and to catch the yearSELECT to_char(dia, 'YYYY') FROM tabela GROUP BY to_char(dia, 'YYYY')
.– William Novak
Thanks guys I’ll assemble here have an ajax code for state cities I will use it as a base
– Cristiano Cardoso Silva