• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

list box of months

New Here ,
Dec 05, 2006 Dec 05, 2006

Copy link to clipboard

Copied

hi i have a list box with months of the year as values,

i have a table with a column dateordered showing dates as "2006/12/04"

if the month December was selected from the list box

how can i get the results page to show all the table rows that have a month of 12?
TOPICS
Advanced techniques

Views

677

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 05, 2006 Dec 05, 2006

Copy link to clipboard

Copied

2006/12/04 is a three-element list, delimited by the slash ( / ). So if ListGetAt(foo, 2, "/") is 12, you have found a December date.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 05, 2006 Dec 05, 2006

Copy link to clipboard

Copied

What database are you using?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 05, 2006 Dec 05, 2006

Copy link to clipboard

Copied

database is mysql

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 05, 2006 Dec 05, 2006

Copy link to clipboard

Copied

select * from table where month(dateordered) = 12 ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 05, 2006 Dec 05, 2006

Copy link to clipboard

Copied

so...what are you missing? between jdeline's response and stpaz's response, you've got your answer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 05, 2006 Dec 05, 2006

Copy link to clipboard

Copied

i have a column with date values "2006/12/04"

how can i generate my list box, from this column

i would like distinct months to appear?

ie if the column has "2006/12/04" i would like to show December in my list box

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 05, 2006 Dec 05, 2006

Copy link to clipboard

Copied



SELECT DISTINCT DATE_FORMAT(mydatecolumn,%M) as monthname
FROM Mytable
ORDER BY monthname

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 05, 2006 Dec 05, 2006

Copy link to clipboard

Copied

Hi thanks for that i am getting a error on this line
SELECT DISTINCT DATE_FORMAT(DateOfSMS,%M) as monthname

i am using mysql what could be wrong?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 06, 2006 Dec 06, 2006

Copy link to clipboard

Copied

what is the error?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 06, 2006 Dec 06, 2006

Copy link to clipboard

Copied

I lifted the DATE_FORMAT function syntax from the MySQL documentation. Hard for me to test it since I don't have it here.

Also, once you get over this hurdle, add a month-number column and order by that instead of the month name.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 07, 2006 Dec 07, 2006

Copy link to clipboard

Copied

LATEST
Is the field where the date is store a true date field, or is it a text field?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation