Displaying 3 results from an estimated 3 matches for "return_date".
2010 Jul 08
1
Query about using timestamps returned by SQL as 'factor' for split
I have a simple query as follows:
"SELECT
m_id,sale_date,YEAR(sale_date),WEEK(sale_date),return_type,DATEDIFF(return_date,sale_date)
AS elapsed_time FROM risk_input"
I can get, and view, all the data that that query returns. The question is,
sale_date is a timestamp, and I need to call split to group this data by
m_id and the week in which the sale occurred. Obviously, I would normally
need both YEAR and WEEK...
2010 Jul 21
0
One problem with RMySQL and a query that returns an empty recordset
...he SQL below). Because of the above error, I never
see about two thirds of the results that ought to be produced.
At the time that the error occurs, x contains the following SQL query:
SELECT m_id,sale_date,YEAR(sale_date) AS sale_year,MONTH(sale_date) AS
sale_month,return_type,0.0001 + DATEDIFF(return_date,sale_date) AS
elapsed_time FROM `merchants2`.`risk_input` WHERE m_id = 361 AND return_type
= 1 AND DATEDIFF(return_date,sale_date) IS NOT NULL;
If I execute this SQL, I find the resultset is empty. So assigning the
value returned by dbGetQuery to moreinfo works ONLY if the resultset is not
empty....
2010 Jul 16
1
I need help making a data.fame comprised of selected columns of an original data frame.
I must have missed something simple, but still, i don't know what.
I obtained my basic data as follows:
x <- sprintf("SELECT m_id,sale_date,YEAR(sale_date) AS
sale_year,WEEK(sale_date) AS sale_week,return_type,0.0001 +
DATEDIFF(return_date,sale_date) AS elapsed_time FROM
`merchants2`.`risk_input` WHERE DATEDIFF(return_date,sale_date) IS NOT
NULL")
moreinfo <- dbGetQuery(con, x)
I then made the data frame I want to use as follows:
fun_m_id <- function(df)
if (length(df$elapsed_time) > 5) {
rv = fitdist(df$elapsed...