In MS Access, what query expression do I need to group julian day by 10 day bins? Ex: Julian day 1 - 10 will be group 1
-
I've written this code, but access says it's too complex. Any suggestions to get it simpler? Binned: IIf([Julian Day]<11,"Bin 1",(IIf([Julian Day]<21,"Bin 2",(IIf([Julian Day]<31,"Bin 3",(IIf([Julian Day]<41,"Bin 3",(IIf([Julian Day]<51,"Bin 4",(IIf([Julian Day]<61,"Bin 5",(IIf([Julian Day]<71,"Bin 6",(IIf([Julian Day]<81,"Bin 7",(IIf([Julian Day]<91,"Bin 8",(IIf([Julian Day]<101,"Bin 9",(IIf([Julian Day]<111,"Bin 10",Null))))))))))))))))))))) I need to goto Julian day 140.
-
Answer:
Is [Julian Day] a field name of a date field? If so, then try this query: SELECT [Julian Date], int((datepart('y', [Julian Date]) - 1) /10) + 1 as Bin FROM [TheTable] The datepart function with the 'y' flag converts the date to the Julian day of the year. Subracting 1 from that day offsets the number so that 10 is included with 1-9, instead of 0). Dividing that number by 10 gets you close to the Bin number, but with a decimal. Adding 1 to this number makes the Bin number start at 1 instead of 0. The INT function removes the decimal. If you want to see each part in action, try this query: SELECT [Julian Date], datepart('y', [Julian Date]) as TheJulianDay, datepart('y', [Julian Date]) - 1 as TheJulianDayMinus1, (datepart('y', [Julian Date]) - 1) /10 as TheJDDiv10, ((datepart('y', [Julian Date]) - 1) /10) + 1 as TheJDDiv10Plus1, int((datepart('y', [Julian Date]) - 1) /10) + 1 as Bin FROM [TheTable] I love MS Access. I am such a geek. I hope this helps.
cahudak at Amazon Askville Visit the source
Related Q & A:
- What size Snowboard do I need?Best solution by Yahoo! Answers
- What is an .emz file and what is the software I need to open it?Best solution by Yahoo! Answers
- What digital box do I need if i get Comcast Cable for free?Best solution by Yahoo! Answers
- What are some things I need to know about living in Germany before I go there for a year?Best solution by Yahoo! Answers
- What are the courses I need to take in high school to become a zoologist?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.