I keep getting a unexpected select error in my snosql statementHow to make the first option of <select> selected with jQueryHow do I UPDATE from a SELECT in SQL Server?Create a temporary table in a SELECT statement without a separate CREATE TABLEjQuery get value of select onChangeSelecting multiple columns in a pandas dataframeOuter join the output of two select statement - mysqltrouble in SQL join two SELECT statementMySQL Syntax error on a delete from a select set?Statement couldn't be produced with sql in ZendDbSqlSelectCodeigniter join statement with a join statement

Why was the small council so happy for Tyrion to become the Master of Coin?

Addon: add submenu

The iconography of Laddu Gopal's soles

How can bays and straits be determined in a procedurally generated map?

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

Have astronauts in space suits ever taken selfies? If so, how?

Mathematical cryptic clues

Modeling an IPv4 Address

Mains transformer blew up amplifier, incorrect description in wiring instructions?

What do the dots in this tr command do: tr .............A-Z A-ZA-Z <<< "JVPQBOV" (with 13 dots)

Is it possible to rebuild the bike frame (to make it lighter) by welding aluminum tubes

Why are 150k or 200k jobs considered good when there are 300k+ births a month?

What is the offset in a seaplane's hull?

Type 1 Error & Type 2 Error's pregnancy test analogy: is it legit?

Why don't electromagnetic waves interact with each other?

Is the language p and n are natural numbers and there's no prime number in [p,p+n] belongs to NP class?

Languages that we cannot (dis)prove to be Context-Free

Can I make popcorn with any corn?

Is it possible to do 50 km distance without any previous training?

Is it possible to make sharp wind that can cut stuff from afar?

If I cast Expeditious Retreat, can I Dash as a bonus action on the same turn?

If two metric spaces are topologically equivalent (homeomorphic) imply that they are complete?

Email Account under attack (really) - anything I can do?

How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?



I keep getting a unexpected select error in my snosql statement


How to make the first option of <select> selected with jQueryHow do I UPDATE from a SELECT in SQL Server?Create a temporary table in a SELECT statement without a separate CREATE TABLEjQuery get value of select onChangeSelecting multiple columns in a pandas dataframeOuter join the output of two select statement - mysqltrouble in SQL join two SELECT statementMySQL Syntax error on a delete from a select set?Statement couldn't be produced with sql in ZendDbSqlSelectCodeigniter join statement with a join statement






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I keep getting an unexpected select error as well as an unexpected ON error in rows 61 AND 64 in my snowsql statement.



Not sure why if anyone can help that would be great. I've added the portion of my snowsql statement below.



I'm trying to use a select statement within a where clause is there a way to do this?



AS select
t1.sunday_date,
t1.sunday_year_month,
t1.sunday_month,
t1.dc,
t1.source_sku,
t1.Product_Family,
t1.Product_type,
t1.Product_Subtype,
t1.Material,
t1.Color,
t1.Size,
t1.EOL_Date,
t1.NPI_Date,
t1.period_start,
t1.period_month,
IIF( t4.period_start < t1.sunday_date, iif(ISNULL(ta.actual_quantity), 0, ta.actual_quantity),
IIF(ISNULL(tfc.SOPFCSTOVERRIDE ), iif(ISNULL(tf.Period_Start), 0, tf.dc_forecast) , tfc.SOPFCSTOVERRIDE
)) AS forecast_updated,
iif(ISNULL(tf.Period_Start),t4.period_start,tf.Period_Start) AS period_start_forecast,
iif(ISNULL(ti.VALUATED_UNRESTRICTED_USE_STOCK), 0, ti.VALUATED_UNRESTRICTED_USE_STOCK) AS inventory_quantity,
iif(ISNULL(ti.HCI_DS_KEYFIGURE_QUANTITY), 0, ti.HCI_DS_KEYFIGURE_QUANTITY) AS in_transit_quantity,
iif(ISNULL(ti.planned_quantity), 0, ti.planned_quantity) AS inbound_quantity,
iif(ISNULL(tbac.backlog_ecomm ), 0, tbac.backlog_ecomm) + iif(ISNULL(tbac_sap.backlog_sap_open), 0, tbac_sap.backlog_sap_open) AS backlog_quantity,
iif(ISNULL(ta.actual_quantity), 0, ta.actual_quantity) AS actual_quantity,
iif(ISNULL(tso.open_orders), 0, tso.open_orders) AS open_orders,
iif(ISNULL(tf.Period_Start), 0, tf.dc_forecast) AS forecast,
tfc.SOPFCSTOVERRIDE AS forecast_consumption,
iif(ISNULL(tpc.SHIP_DATE), 0, tpc.SHIP_DATE) AS production_current_week,
iif(ISNULL(tpc.SHIP_DATE), 0, tpc.SHIP_DATE) AS production_next_week,
NOW() AS updated_timestamp

FROM ( ( ( ( ( ( ( ( (

SELECT
e.sunday_date,
e.sunday_month,
e.sunday_year_month,
d.dc,
c.SOURCE_SKU,
c.Product_Family,
c.Product_Type,
c.Product_Subtype,
c.Material,
c.Color,
c.Size,
c.EOL_Date,
c.NPI_Date,
b.period_start,
b.period_month


FROM
(SELECT sunday_date, sunday_month, sunday_year_month FROM bas_report_date) AS e,
(SELECT distinct Week_Date AS period_start, DateSerial('445_Year','445_Month',1) AS period_month from inv_bas_445_Month_Alignment) AS b,
(SELECT source_sku AS source_sku, Product_Family, Product_Type, Product_Subtype, Material, Color, Size, EOL_Date, NPI_Date from inv_vw_product_dev ) AS c,
(SELECT dc AS dc FROM inv_bas_dc_site_lookup) AS d

WHERE b.period_start >=
( select
MIN(mt.Reference_Date )
FROM BAS_report_date tr
INNER JOIN inv_bas_445_Month_Alignment mt ON tr.sunday_month = DateSerial(mt.'445_Year',mt.'445_Month,1')
)

AND b.period_start <= DateAdd("ww", 26,e.sunday_date)

) t1

LEFT JOIN
(
SELECT
MATERIAL_NUMBER,
CINT(LOCATION_NUMBER) AS Int_Location_ID,
HCI_DS_KEYFIGURE_DATE,
HCI_DS_KEYFIGURE_QUANTITY,
PLANNED_QUANTITY,
VALUATED_UNRESTRICTED_USE_STOCK

FROM inv_vw_ibp_transit_inventorry_dev
) ti









share|improve this question






























    0















    I keep getting an unexpected select error as well as an unexpected ON error in rows 61 AND 64 in my snowsql statement.



    Not sure why if anyone can help that would be great. I've added the portion of my snowsql statement below.



    I'm trying to use a select statement within a where clause is there a way to do this?



    AS select
    t1.sunday_date,
    t1.sunday_year_month,
    t1.sunday_month,
    t1.dc,
    t1.source_sku,
    t1.Product_Family,
    t1.Product_type,
    t1.Product_Subtype,
    t1.Material,
    t1.Color,
    t1.Size,
    t1.EOL_Date,
    t1.NPI_Date,
    t1.period_start,
    t1.period_month,
    IIF( t4.period_start < t1.sunday_date, iif(ISNULL(ta.actual_quantity), 0, ta.actual_quantity),
    IIF(ISNULL(tfc.SOPFCSTOVERRIDE ), iif(ISNULL(tf.Period_Start), 0, tf.dc_forecast) , tfc.SOPFCSTOVERRIDE
    )) AS forecast_updated,
    iif(ISNULL(tf.Period_Start),t4.period_start,tf.Period_Start) AS period_start_forecast,
    iif(ISNULL(ti.VALUATED_UNRESTRICTED_USE_STOCK), 0, ti.VALUATED_UNRESTRICTED_USE_STOCK) AS inventory_quantity,
    iif(ISNULL(ti.HCI_DS_KEYFIGURE_QUANTITY), 0, ti.HCI_DS_KEYFIGURE_QUANTITY) AS in_transit_quantity,
    iif(ISNULL(ti.planned_quantity), 0, ti.planned_quantity) AS inbound_quantity,
    iif(ISNULL(tbac.backlog_ecomm ), 0, tbac.backlog_ecomm) + iif(ISNULL(tbac_sap.backlog_sap_open), 0, tbac_sap.backlog_sap_open) AS backlog_quantity,
    iif(ISNULL(ta.actual_quantity), 0, ta.actual_quantity) AS actual_quantity,
    iif(ISNULL(tso.open_orders), 0, tso.open_orders) AS open_orders,
    iif(ISNULL(tf.Period_Start), 0, tf.dc_forecast) AS forecast,
    tfc.SOPFCSTOVERRIDE AS forecast_consumption,
    iif(ISNULL(tpc.SHIP_DATE), 0, tpc.SHIP_DATE) AS production_current_week,
    iif(ISNULL(tpc.SHIP_DATE), 0, tpc.SHIP_DATE) AS production_next_week,
    NOW() AS updated_timestamp

    FROM ( ( ( ( ( ( ( ( (

    SELECT
    e.sunday_date,
    e.sunday_month,
    e.sunday_year_month,
    d.dc,
    c.SOURCE_SKU,
    c.Product_Family,
    c.Product_Type,
    c.Product_Subtype,
    c.Material,
    c.Color,
    c.Size,
    c.EOL_Date,
    c.NPI_Date,
    b.period_start,
    b.period_month


    FROM
    (SELECT sunday_date, sunday_month, sunday_year_month FROM bas_report_date) AS e,
    (SELECT distinct Week_Date AS period_start, DateSerial('445_Year','445_Month',1) AS period_month from inv_bas_445_Month_Alignment) AS b,
    (SELECT source_sku AS source_sku, Product_Family, Product_Type, Product_Subtype, Material, Color, Size, EOL_Date, NPI_Date from inv_vw_product_dev ) AS c,
    (SELECT dc AS dc FROM inv_bas_dc_site_lookup) AS d

    WHERE b.period_start >=
    ( select
    MIN(mt.Reference_Date )
    FROM BAS_report_date tr
    INNER JOIN inv_bas_445_Month_Alignment mt ON tr.sunday_month = DateSerial(mt.'445_Year',mt.'445_Month,1')
    )

    AND b.period_start <= DateAdd("ww", 26,e.sunday_date)

    ) t1

    LEFT JOIN
    (
    SELECT
    MATERIAL_NUMBER,
    CINT(LOCATION_NUMBER) AS Int_Location_ID,
    HCI_DS_KEYFIGURE_DATE,
    HCI_DS_KEYFIGURE_QUANTITY,
    PLANNED_QUANTITY,
    VALUATED_UNRESTRICTED_USE_STOCK

    FROM inv_vw_ibp_transit_inventorry_dev
    ) ti









    share|improve this question


























      0












      0








      0








      I keep getting an unexpected select error as well as an unexpected ON error in rows 61 AND 64 in my snowsql statement.



      Not sure why if anyone can help that would be great. I've added the portion of my snowsql statement below.



      I'm trying to use a select statement within a where clause is there a way to do this?



      AS select
      t1.sunday_date,
      t1.sunday_year_month,
      t1.sunday_month,
      t1.dc,
      t1.source_sku,
      t1.Product_Family,
      t1.Product_type,
      t1.Product_Subtype,
      t1.Material,
      t1.Color,
      t1.Size,
      t1.EOL_Date,
      t1.NPI_Date,
      t1.period_start,
      t1.period_month,
      IIF( t4.period_start < t1.sunday_date, iif(ISNULL(ta.actual_quantity), 0, ta.actual_quantity),
      IIF(ISNULL(tfc.SOPFCSTOVERRIDE ), iif(ISNULL(tf.Period_Start), 0, tf.dc_forecast) , tfc.SOPFCSTOVERRIDE
      )) AS forecast_updated,
      iif(ISNULL(tf.Period_Start),t4.period_start,tf.Period_Start) AS period_start_forecast,
      iif(ISNULL(ti.VALUATED_UNRESTRICTED_USE_STOCK), 0, ti.VALUATED_UNRESTRICTED_USE_STOCK) AS inventory_quantity,
      iif(ISNULL(ti.HCI_DS_KEYFIGURE_QUANTITY), 0, ti.HCI_DS_KEYFIGURE_QUANTITY) AS in_transit_quantity,
      iif(ISNULL(ti.planned_quantity), 0, ti.planned_quantity) AS inbound_quantity,
      iif(ISNULL(tbac.backlog_ecomm ), 0, tbac.backlog_ecomm) + iif(ISNULL(tbac_sap.backlog_sap_open), 0, tbac_sap.backlog_sap_open) AS backlog_quantity,
      iif(ISNULL(ta.actual_quantity), 0, ta.actual_quantity) AS actual_quantity,
      iif(ISNULL(tso.open_orders), 0, tso.open_orders) AS open_orders,
      iif(ISNULL(tf.Period_Start), 0, tf.dc_forecast) AS forecast,
      tfc.SOPFCSTOVERRIDE AS forecast_consumption,
      iif(ISNULL(tpc.SHIP_DATE), 0, tpc.SHIP_DATE) AS production_current_week,
      iif(ISNULL(tpc.SHIP_DATE), 0, tpc.SHIP_DATE) AS production_next_week,
      NOW() AS updated_timestamp

      FROM ( ( ( ( ( ( ( ( (

      SELECT
      e.sunday_date,
      e.sunday_month,
      e.sunday_year_month,
      d.dc,
      c.SOURCE_SKU,
      c.Product_Family,
      c.Product_Type,
      c.Product_Subtype,
      c.Material,
      c.Color,
      c.Size,
      c.EOL_Date,
      c.NPI_Date,
      b.period_start,
      b.period_month


      FROM
      (SELECT sunday_date, sunday_month, sunday_year_month FROM bas_report_date) AS e,
      (SELECT distinct Week_Date AS period_start, DateSerial('445_Year','445_Month',1) AS period_month from inv_bas_445_Month_Alignment) AS b,
      (SELECT source_sku AS source_sku, Product_Family, Product_Type, Product_Subtype, Material, Color, Size, EOL_Date, NPI_Date from inv_vw_product_dev ) AS c,
      (SELECT dc AS dc FROM inv_bas_dc_site_lookup) AS d

      WHERE b.period_start >=
      ( select
      MIN(mt.Reference_Date )
      FROM BAS_report_date tr
      INNER JOIN inv_bas_445_Month_Alignment mt ON tr.sunday_month = DateSerial(mt.'445_Year',mt.'445_Month,1')
      )

      AND b.period_start <= DateAdd("ww", 26,e.sunday_date)

      ) t1

      LEFT JOIN
      (
      SELECT
      MATERIAL_NUMBER,
      CINT(LOCATION_NUMBER) AS Int_Location_ID,
      HCI_DS_KEYFIGURE_DATE,
      HCI_DS_KEYFIGURE_QUANTITY,
      PLANNED_QUANTITY,
      VALUATED_UNRESTRICTED_USE_STOCK

      FROM inv_vw_ibp_transit_inventorry_dev
      ) ti









      share|improve this question
















      I keep getting an unexpected select error as well as an unexpected ON error in rows 61 AND 64 in my snowsql statement.



      Not sure why if anyone can help that would be great. I've added the portion of my snowsql statement below.



      I'm trying to use a select statement within a where clause is there a way to do this?



      AS select
      t1.sunday_date,
      t1.sunday_year_month,
      t1.sunday_month,
      t1.dc,
      t1.source_sku,
      t1.Product_Family,
      t1.Product_type,
      t1.Product_Subtype,
      t1.Material,
      t1.Color,
      t1.Size,
      t1.EOL_Date,
      t1.NPI_Date,
      t1.period_start,
      t1.period_month,
      IIF( t4.period_start < t1.sunday_date, iif(ISNULL(ta.actual_quantity), 0, ta.actual_quantity),
      IIF(ISNULL(tfc.SOPFCSTOVERRIDE ), iif(ISNULL(tf.Period_Start), 0, tf.dc_forecast) , tfc.SOPFCSTOVERRIDE
      )) AS forecast_updated,
      iif(ISNULL(tf.Period_Start),t4.period_start,tf.Period_Start) AS period_start_forecast,
      iif(ISNULL(ti.VALUATED_UNRESTRICTED_USE_STOCK), 0, ti.VALUATED_UNRESTRICTED_USE_STOCK) AS inventory_quantity,
      iif(ISNULL(ti.HCI_DS_KEYFIGURE_QUANTITY), 0, ti.HCI_DS_KEYFIGURE_QUANTITY) AS in_transit_quantity,
      iif(ISNULL(ti.planned_quantity), 0, ti.planned_quantity) AS inbound_quantity,
      iif(ISNULL(tbac.backlog_ecomm ), 0, tbac.backlog_ecomm) + iif(ISNULL(tbac_sap.backlog_sap_open), 0, tbac_sap.backlog_sap_open) AS backlog_quantity,
      iif(ISNULL(ta.actual_quantity), 0, ta.actual_quantity) AS actual_quantity,
      iif(ISNULL(tso.open_orders), 0, tso.open_orders) AS open_orders,
      iif(ISNULL(tf.Period_Start), 0, tf.dc_forecast) AS forecast,
      tfc.SOPFCSTOVERRIDE AS forecast_consumption,
      iif(ISNULL(tpc.SHIP_DATE), 0, tpc.SHIP_DATE) AS production_current_week,
      iif(ISNULL(tpc.SHIP_DATE), 0, tpc.SHIP_DATE) AS production_next_week,
      NOW() AS updated_timestamp

      FROM ( ( ( ( ( ( ( ( (

      SELECT
      e.sunday_date,
      e.sunday_month,
      e.sunday_year_month,
      d.dc,
      c.SOURCE_SKU,
      c.Product_Family,
      c.Product_Type,
      c.Product_Subtype,
      c.Material,
      c.Color,
      c.Size,
      c.EOL_Date,
      c.NPI_Date,
      b.period_start,
      b.period_month


      FROM
      (SELECT sunday_date, sunday_month, sunday_year_month FROM bas_report_date) AS e,
      (SELECT distinct Week_Date AS period_start, DateSerial('445_Year','445_Month',1) AS period_month from inv_bas_445_Month_Alignment) AS b,
      (SELECT source_sku AS source_sku, Product_Family, Product_Type, Product_Subtype, Material, Color, Size, EOL_Date, NPI_Date from inv_vw_product_dev ) AS c,
      (SELECT dc AS dc FROM inv_bas_dc_site_lookup) AS d

      WHERE b.period_start >=
      ( select
      MIN(mt.Reference_Date )
      FROM BAS_report_date tr
      INNER JOIN inv_bas_445_Month_Alignment mt ON tr.sunday_month = DateSerial(mt.'445_Year',mt.'445_Month,1')
      )

      AND b.period_start <= DateAdd("ww", 26,e.sunday_date)

      ) t1

      LEFT JOIN
      (
      SELECT
      MATERIAL_NUMBER,
      CINT(LOCATION_NUMBER) AS Int_Location_ID,
      HCI_DS_KEYFIGURE_DATE,
      HCI_DS_KEYFIGURE_QUANTITY,
      PLANNED_QUANTITY,
      VALUATED_UNRESTRICTED_USE_STOCK

      FROM inv_vw_ibp_transit_inventorry_dev
      ) ti






      select snowflake snowsql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 9 at 18:54









      georgeawg

      34.5k115370




      34.5k115370










      asked Mar 9 at 2:47









      2tone_tony2tone_tony

      53




      53






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073533%2fi-keep-getting-a-unexpected-select-error-in-my-snosql-statement%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073533%2fi-keep-getting-a-unexpected-select-error-in-my-snosql-statement%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229