Displaying 3 results from an estimated 3 matches for "sqlish".
2006 Apr 11
2
Getting distinct years from a date column the Rails way
I have an original_at column in my photos table. I''d like to get a list
of distinct years that occur in this column, and some of the values are
NULL. I see two ways of doing this. The SQLish way:
photos = Photo.find :all, :select => ''distinct year(original_at)''
This is efficient in that it utilizes the database to do the filtering,
and the code is not too ugly. The big downside is that I have to access
the results like this:
@years = photos.map {|p| p['...
2010 Dec 16
1
Is there a join() function in R ? OR: simulating "Combining ggplot2 and Google Maps" by David Kahle
...ne by line to make sure I understand what every line of code
does and then applying it to my own data. When I run the code however, it
breaks on the following line:
df <- suppressMessages(join(df_xyll, m_map, type = 'right'))
I do not seem to have the join() function. This looks almost SQLish. I have
tried ??join and looking on CRAN and a google search but I cannot find this
function. Is there a special library that one has to install for this to
work? Can anyone help please.
Best regards
Christiaan
[[alternative HTML version deleted]]
2006 Aug 17
8
Creating queries..
Hi, I am trying to implement a few queries now. What are good ways to do
this?
Right now, I have a list page that does sorting and can carry out a
generic pagination request.
@user_result_pages, @user_results = paginate(:user_results,
:per_page => 20,
:conditions => @condition,
:order_by => @sort_order)
I create @sort_order earlier in the list function. The problem I am
having is