search for: ifnull

Displaying 4 results from an estimated 4 matches for "ifnull".

Did you mean: fnull
2009 Feb 15
3
conditions on association include, hacky but more or less solved
...:include => [:trait_values => [:key_factors]], :joins => " AND key_factors.entity_id="+@entity.id.to_s, :conditions => "trait_values.trait_id = traits.id AND IFNULL (key_factors.id,0) = IFNULL(key_factors.id,0)", Which finally produces FROM `traits` LEFT OUTER JOIN `trait_values` ON trait_values.trait_id = traits.id LEFT OUTER JOIN `key_factors` ON key_factors.trait_value_id = trait_values.id AN...
2010 Jul 25
1
Left Outer Join 2 DF's on Multiple Conditions
Hi, I am trying to execute the following SQL statement using two data frames: tab1, tab2 : Two Tables Select tab1.*, tab2.*, tab1.tobiiTime - tab2.ruiTime as timeDiff, IFNULL(n-m, -9999999) as alwaysIncrement FROM tab1 LEFT OUTER JOIN tab2 On tab1.data1 - tab2.mouseX = 0 And tab1.data2 - tab2.mouseY = 0 I am trying to do the following in R:- *#Getting error here:* data <- merge(tab1,tab2, all.x=TRUE, by=(data$data1 - data$mouseX == 0), by=(data$d...
2009 Nov 09
3
How can I improve a Ruby on Rails code that hast a lot of SQL as strings?
...es, :as => :voteable def self.ranking(user_id) Item.find(:all, # items.* for all the Item attributes, score being the sum of votes, user_vote is the vote of user_id (0 if no vote) and voter_id is just user_id for latter reference. :select => "items.*, IFNULL(sum(all_votes.value), 0) as score, user_votes.value as user_vote, \"#{user_id}\" as voter_id", # The first join gets all the votes for a single item (to be summed latter). # The second join gets the vote for a single user for a single i...
2008 Jul 26
4
Data length mismatch.
I have two vectos (list) that represent a years of data. Each "row" is represented by the day of year and the quantity that was sold for that day. I would like to form a new vector that is the difference between the two years of data. A sample of A (and similarly B) looks like: > A[1:5,] DayOfYear x 1 1 1429 2 2 3952 3 3 3049 4 4 2844 5 5