MySQL – Year Over Year – Query Syntax

Experts

I am working on a query to get Year over Year data comparison from current year to prior year.

For example, if current year is Jan 1st – now, I would calc that dynamically in my query but also bring in the previous year data for the same time frame (does that make sense?).

Here is my projection query that brings in current year and prior year but the data is dynamic yet static if that makes sense. CY is focusing on all of YTD while PY is doing entire PY.

How would I match PY to mimic what CY is doing essentially giving me all the data that I am needing from PY to do the comparison.

I would appreciate your help in advance.

        current_4wk_sales.store_no as 'store_no',         current_4wk_sales.store_name as 'store_name',         current_4wk_sales.zee_name as 'franchisee',         current_4wk_sales.marketing_source as 'region',         current_4wk_sales.cy_projections as 'cy_projections',         prev_wk_sales.prev_year_sales as 'prev_year_sales',         round(((current_4wk_sales.cy_projections - prev_wk_sales.prev_year_sales) / prev_wk_sales.prev_year_sales), 2) * 100 as 'percent_chng' from (     select store.store_uin,            store.store_no,            store.store_name,            store.zee_name,            store.marketing_source,            round((((sum(ro.total_sales - ro.taxes) / 100)) / (DAYOFYEAR(current_date() - INTERVAL 2 DAY))) * 365, 2) as 'cy_projections'      from cba_data_warehouse.raw_tm_data ro     join cba_data_warehouse.storeinfo store on ro.store_no = store.store_no     where posted_date between MAKEDATE(EXTRACT(YEAR FROM CURDATE()),1) and LAST_DAY(DATE_ADD(NOW(), INTERVAL 12-MONTH(NOW()) MONTH)) and ro.repair_order_status_id in (5,6)     group by store.store_uin, store.store_no, store.store_name     order by store.store_no asc ) as current_4wk_sales left join (     select         store.store_uin,         store.store_no,         store.store_name,         store.zee_name,         store.marketing_source,         round(sum(ro.total_sales - ro.taxes) / 100,2) as prev_year_sales      from cba_data_warehouse.raw_tm_data ro     join cba_data_warehouse.storeinfo store on ro.store_no = store.store_no     where ro.repair_order_status_id in (5, 6)     and ro.posted_date between MAKEDATE(year(now() - INTERVAL 1 YEAR),1) and DATE(CURDATE()- INTERVAL DAYOFYEAR(CURDATE()) DAY)     group by store.store_uin, store.store_no, store.store_name     order by store.store_no asc ) prev_wk_sales on prev_wk_sales.store_uin = current_4wk_sales.store_uin                 and prev_wk_sales.store_no = current_4wk_sales.store_no                 and prev_wk_sales.store_name = current_4wk_sales.store_name```  Thanks in advance! 

trouble in distinguishing between syntax directed translation and syntax directed definition

I am currently reading the dragon book ,chapter 2 is confusing me a lot according to it the definition of the two terms are:

syntax-directed translation

syntax-Directed translation is done by attaching rules or program fragments o productions in a grammar

my understanding of this is that in a production within {} we have some rules/program code that is executed(those rules/program are also known as semantic action)

syntax-directed-definition

A syntax-directed definition associates 1.with each grammar symbol, a set of attributes and 2.With each production,a set of semantic rules for computing the values of the attribute associated with the symbols appearing in the production

my understanding of this definition is that with each production we associate a action at the end of tail to compute the value of a attribute(this action are also known as semantic rules)

I have a few doubts regarding the two definitions 1. Is my understanding of this two definition correct?

  1. do syntax directed translation and syntax directed definition do the same task using two different ways?

  2. Is a syntax directedtranslation scheme same as syntax directed translation?

  3. what is the difference between syntax directed translation scheme and just translation scheme?

Syntax error around converting timestamps to time

I am writing a function that requires some comparison between the difference date and time parts of the timestamp data type. However it keeps running into syntax errors and I cannot find out what is going on. I looked into this post and keep having alternating errors like

psql:ERROR: operator does not exist: time without time zone >= timestamp with time zone and

plpgsql: No function matches the given name and argument types. You might need to add explicit type casts

Can anyone enlighten me what is wrong and what could be a direction I can head towards?

create or replace function riders_available_at_date_time(specified timestamp) returns table(riderId integer) as     $  $       begin         select F.riderId         from FullTimeRiders F         where specified::date between F.startDate and F.startDate+27         and exists (             select 1             from MWSWorkDays M join ShiftsInformation S on (S.shiftNumber = M.shift)             where M.riderId = F.riderId             and (specified::time without time zone between to_timestamp(to_char(firstStartHour, '99'), 'HH24')                 and to_timestamp(to_char(firstEndHour, '99'), 'HH24')) or                 (specified::time without time zone between to_timestamp(to_char(secondStartHour, '99'), 'HH24') and                     to_timestamp(to_char(secondEndHour, '99'), 'HH24'))                   )           union         select riderId         from PartTimeWorkingHourIntervals P         where specified between calculate_start_date(P.dayIndex, P.startDate)+P.startHour             and calculate_start_date(P.dayIndex, P.startDate) + P.endHour;     end;     $  $   language plpgsql;   create or replace function calculate_start_date(index int, starting date) returns date as     $  $       declare         position integer;     begin         select extract(dow from starting::date) into position;         index = (index - position)%7;         return starting + index;     end;     $  $   language plpgsql; 

Parse error: syntax error, unexpected ‘,’

I have been following along a basic tutorial on creating a simple theme structure. I have searched quite a few articles to get an understanding and looked at debugging tips, however I am at a loss, probably due to me limited knowledge base. At this stage I had downloaded bootstrap css and js folders. This is on a local server and I don’t have any plugins installed or activated.

After quite a number of error messages I have come down to this one. Sorry, I don’t remember what changes I made in the functions file to get to this one.

Parse error: syntax error, unexpected ‘,’ in D:\xampp\htdocs\myih\wp-content\themes\mytheme\functions.php on line 8 (line 8 starts at wp_register…..) enter image description here

Thanks

Hashcat syntax correction

I’ve been cracking a box and I came across a password list and another file with the pass configuration. $ hash= md5($ salt . pass . salt) I have both salts and the password hash.

I tried with this syntax : hashcat -m 3800 -a 0 '/path/to/pass/list' '/path/to/dictionary/list' No devices found/left

It gives me nothing on return but an error saying there’s not devices or anything. Im trying to get hashcat to crack these passwords. I’ve made a copy of my list and edited the list to have “User:salt:pass:salt”. run it against rockyou.txt. What is my hashcat syntax missing specifically?

What is this function syntax doing? [duplicate]

I’m trying to work my way through another person’s notebook. I came across this function definition:

H[cpl_] :=   H[cpl] = Function[y,     Sqrt[(1. + y + RneuT[cpl][y] + RL[cpl]*y^4)/        2./(1 + RneuT[cpl][1]/2. + RL[cpl]/2.)]/y] 

What’s going on here with the H[cpl_] := H[cpl] = … syntax? This appears to be explicitly assigning the return value – which is, itself, a function – to the return value of this function. I can’t find any documentation on this syntax. Could anyone explain what’s going on or give me relevant link?

Multi pass Surface – erro syntax

I’m trying to make a multiple pass using two [blending] for each one, but he accuses in one place, there is nothing, I don’t understand why

Parse error: syntax error, unexpected TOK_PASS, expecting TOK_SETTEXTURE or ‘}’ at line 28

    SubShader {     ZWrite Off     Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" "PreviewType"="Plane" }     Pass     {         //transparency         Blend SrcAlpha One         CGPROGRAM             #pragma surface surf Lambert              #pragma target 3.0             struct Input             {                 //             };             sampler2D //;             void surf (Input IN, inout SurfaceOutput o)             {                 //             }         }      ENDCG     }     Pass     {          //alphabend         Blend SrcAlpha OneMinusSrcAlpha         CGPROGRAM         #pragma surface surf Lambert         #pragma target 3.0           sampler2D//;          fixed4 //;           struct Input           {           //;          };          void surf(Input IN, inout SurfaceOutput o)          {          //          }         ENDCG     } } 

Calculated Field Syntax Error – Matrix Output

I’m quite new to this, could anyone point out why my calculated field isn’t working

Im trying to use a matrix to output a value of critical, high, medium or low

The field Im using is ImpUrg_Total, this is my current failure

=IF(ImpUrg_Total<2,”Critical”,IF(AND([ImpUrg_Total]>=2,[ImpUrg_Total]<4,”High”,IF(AND([ImpUrg_Total]>=4,[ImpUrg_Total]<9,”Medium”,IF([ImpUrg_Total]=>9,”Low”))))))