I have a query I wrote, so that I can count number of days with (Credit) in a time frame dropping the time from month/day/yr: select count (distinct extract (day from column_name)) as Number_of_days from table_name where (enter time frame to time frame)**date and (column_name='credit') order by extract (day from column_name) If I put April 1, 2012 to April 30, 2012 I would get : Number_of_days 21 **21 days of April have "Credit" I remove some of the real info and added examples. Anyway, does another know what I would need to do to get multiple months and results? Like if I wanted to show April and May and count for each to display. I thought I would just add : select count Month (distinct extract (day from column_name)) as Number_of_days from table_name where (enter time frame to time frame)**date and (column_name='credit') order by extract (day from column_name) group by month (distinct extract (day from column_name)
I'm not too familiar with MySQL but this may work. You'll need to move the month in the select statement to before "count" and group it by the month, not the day. select extract (month from column_name), count (distinct extract (day from column_name)) as Number_of_days from table_name where (enter time frame to time frame)**date and (column_name='credit') order by extract (day from column_name) group by extract (month from column_name) This works in SQL Server to give you and idea of it, but I think it would group data from the same month in different years as it's written now. select MONTH(column), count(distinct (CONVERT(date, column))) from Table group by MONTH(column)
Don't know if you can do this with MySQL, but... you should have something similar to MS SQL's "DATEDIFF." http://msdn.microsoft.com/en-us/library/ms189794(v=sql.90).aspx EDIT: I think you DO have this. Use the appropriate parameters for a Modulus of days reminding. http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html Look at that, you already have two responses! Aren't you a Luckyazn, indeed?
I don't think DateDiff will give him what he's looking for, since not all days in that range will have an entry. For the range: 6/1/12 6/2/12 6/3/12 6/4/12 There are four days, but there may only be entries for two of the days.
Thanks! This one help Now it shows "4" (April) "21" Credit "5" (May) "23" Credit How do you convert "4" to display "April" ?
Try using the MONTHNAME function. I'm not sure if it will work, but try this: select MONTHNAME(column_name), count (distinct extract (day from column_name)) as Number_of_days from table_name where (enter time frame to time frame)**date and (column_name='credit') order by extract (day from column_name) group by MONTHNAME (column_name)
I added to_char(column_name,'Month') as Month now I have two columns one with Month with the numbers "3" another with Month_1 with the name "March" for some reason I can't get to_char to go into the extract(month from column_name) statement to only display the NAME column
You might want to create your own business calendar.. if you just want remove weekends... tehre's an oracle function for that..
I'm not sure what's going on there, and not knowing MySQL very well and not having a place to try stuff out I'm not sure how to solve it.
Thanks for the help anyway, DrLudicrous. I think I have it now, but I'm just stuck on: how do you order by "month order" Is listing April, Feb, Jan, March, May in ABC order how do you get "month order" like "jan, feb, march, april, may" thanks anyone,
Sounds like someone missed a few SQL classes. SRSLY, though, GUISE, I don't think he's really "azn", or he would have already solved it.
Ok…so let me start off by saying I’m not a programmer and I’ve never used marcos, VBA, modules, etc… Other than that I’m very proficient with Access (yes I do realize I’m greatly limiting my ability to maximize utility I can get from Access but I plan on schooling myself on VBA in the near future) My problem is that I have about 60 excel files that I would like to batch import into separate tables in access. I’ve read blogs and tried some of the custom functions posted but I can’t get anything to work. Can anyone help me out? I’m probably missing something very basic on wheather I should be utilizing a procedure, a module or a class module. Any help would be much appreciated! -Basketball reasons
Dumb question, but do you have access to any developer resources? Just have them write something up for you real quick.
At my previous employer i had a programmer that worked closely with me but not at my current place of employment..
Ah that sucks. As far as doing it all as one batch, I'm not too sure there's a way outside of some code or at least VB script(I'm not well versed on Access myself), but you might be stuck doing the excel files one by one :/ http://support.microsoft.com/kb/141228 60 is not TOOO bad, heh. I'm probably wrong, but it's just my guess. As the commish, can't you get me season tickets?