sql - How can I combine these two query from the same table? -


Since "Koldfugn Innr does not support connecting via join or outer join clauses" How can I combine these two questions Where do they give me data from the last 2 months? Select

  Starburst_dipta_name, STARBURST_DIPT_AVL, CSE_Rep_Resume with MONTHLY_PAST_DATE, where STARBURST_DIPT_NAME is not a null and YEAR (MONTHLY_PAST_DATE) = YEAR (GETDATE ()) and MONTH (MONTHLY_PAST_DATE) = MONTH (GETDATE ()) - 1 Select starburst_dept_name, starburst_dept_average, from MONTHLY_PAST_DATE to cse_reports_month where starburst_dept_name is not a null and YEAR (MONTHLY_PAST_DATE) = YEAR (GETDATE ()) and MONTH (MONTHLY_PAST_DATE) = MONTH (GETDATE ()) - 2   

I would like a query to add these two how do I do this so that it works in coldfusion do? What would I like to compare Starburst_dipt_verage to last month & gt; Last 2 months ago?

Just to clarify, CF does not support just inner and outer Johns a query (QoQ) Is the name of the cse_reports_month query or the name of the database table? You get by, it seems, with the help of close () is that it is a regular SQL query, not cue.

The following questions should work according to your original argument:

  SELECT Starbrst_dipta_nav, cse_reports_month from MONTHLY_PAST_DATE from Starbrst_dipt_avr where Starbrst_dipta_nav no zero year (month) (MONTHLY_PAST_DATE) = YEAR (GETDATE ()) and (month (MONTHLY_PAST_DATE) = month (GETDATE ()) - 1 or month (MONTHLY_PAST_DATE) = month (GETDATE ()) -2)   

but as That was told, it will not work for January. February You will need to use some different date comparison operators.

Are you depending on represents want to show what (and who MONTHLY_PAST_DATE data), you can do the following (you may need to be modified a little bit according to your specific needs):

  Select starburst_dept_name, starburst_dept_average, the MONTHLY_PAST_DATE cse_reports_month where starburst_dept_name tap and DATEDIFF (m, MONTHLY_PAST_DATE, getdate ()) iN (1,2)    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -