{"id":6612,"date":"2024-04-10T10:00:00","date_gmt":"2024-04-10T02:00:00","guid":{"rendered":"https:\/\/35.220.245.118\/?post_type=blog&#038;p=6612"},"modified":"2025-01-07T11:07:11","modified_gmt":"2025-01-07T03:07:11","slug":"spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8","status":"publish","type":"blog","link":"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/","title":{"rendered":"Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"6612\" class=\"elementor elementor-6612\" data-elementor-post-type=\"blog\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7f43164 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7f43164\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-bc12f80\" data-id=\"bc12f80\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d235e1a de_scroll_animation_no elementor-widget elementor-widget-text-editor\" data-id=\"d235e1a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.18.0 - 20-12-2023 *\/\n.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:#69727d;color:#fff}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap{color:#69727d;border:3px solid;background-color:transparent}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap{margin-top:8px}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter{width:1em;height:1em}.elementor-widget-text-editor .elementor-drop-cap{float:left;text-align:center;line-height:1;font-size:50px}.elementor-widget-text-editor .elementor-drop-cap-letter{display:inline-block}<\/style>\t\t\t\t<p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #1f1f1f; background-color: #ffffff; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">Using SQL Runner to check errors in derived tables<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; background-color: #ffffff; margin-top: 0pt; margin-bottom: 0pt; padding: 0pt 0pt 12pt 0pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">In Looker, a derived table is a query whose output is treated as a table in the database.<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; background-color: #ffffff; margin-top: 0pt; margin-bottom: 0pt; padding: 0pt 0pt 12pt 0pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">For example, you might have a database table called <\/span><span style=\"font-size: 12pt; font-family: 'Roboto Mono',monospace; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">orders<\/span><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"> that has many columns. You want to compute some customer-level aggregate metrics, such as how many orders each customer has placed or when each customer placed their first order. Using either a <\/span><a style=\"text-decoration: none;\" href=\"https:\/\/cloud.google.com\/looker\/docs\/derived-tables#native_derived_tables\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #1155cc; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: underline; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;\">native derived table<\/span><\/a><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"> or a <\/span><a style=\"text-decoration: none;\" href=\"https:\/\/cloud.google.com\/looker\/docs\/derived-tables#sql-based_derived_tables\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #1155cc; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: underline; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;\">SQL-based derived table<\/span><\/a><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">, you can create a new database table named <\/span><span style=\"font-size: 12pt; font-family: 'Roboto Mono',monospace; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">customer_order_summary<\/span><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"> that includes these metrics.<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #1f1f1f; background-color: #ffffff; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"><span style=\"border: none; display: inline-block; overflow: hidden; width: 514px; height: 318px;\"><img decoding=\"async\" style=\"--smush-placeholder-width: 521px; --smush-placeholder-aspect-ratio: 521\/324;margin-left: 0px; margin-top: -6.726966410908448px;\" data-src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXetpKornm2vtlarpgati0LmP3VIedCYNtKDpSj5Z-aD52AhZTUrL75yFMuhQ_5RB8hTbLvcP95OfihOHsqDXf05r5sun0MJGfiPQNYEftWvRbBR-KbcbzeZcpt0_tdbuuXWU_tFtYCmYJxWf3DyNVeq8qdC?key=-44z_xPtw5kA3EK_JMRDFA\" width=\"521.5219512195122\" height=\"324.72696641090835\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" \/><\/span><\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">You can then work with the <\/span><span style=\"font-size: 12pt; font-family: 'Roboto Mono',monospace; color: #188038; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">customer_order_summary<\/span><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"> derived table as if it were any other table in the database.<\/span><\/p><h2 dir=\"ltr\" style=\"line-height: 1.38; background-color: #ffffff; margin-top: 0pt; margin-bottom: 0pt; padding: 6pt 0pt 4pt 0pt;\"><span style=\"font-size: 17pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">Native derived tables and SQL-based derived tables<\/span><\/h2><p dir=\"ltr\" style=\"line-height: 1.38; background-color: #ffffff; margin-top: 0pt; margin-bottom: 12pt; padding: 8pt 0pt 0pt 0pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">To create a derived table in your Looker project, use the <\/span><a style=\"text-decoration: none;\" href=\"https:\/\/cloud.google.com\/looker\/docs\/reference\/param-view-derived-table\"><span style=\"font-size: 12pt; font-family: 'Roboto Mono',monospace; color: #0000ee; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: underline; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;\">derived_table<\/span><\/a><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"> parameter under a <\/span><a style=\"text-decoration: none;\" href=\"https:\/\/cloud.google.com\/looker\/docs\/reference\/param-view\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #1155cc; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: underline; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;\">view<\/span><\/a><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"> parameter. Inside the <\/span><span style=\"font-size: 12pt; font-family: 'Roboto Mono',monospace; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">derived_table<\/span><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"> parameter, you can define the query for the derived table in one of two ways:<\/span><\/p><ul style=\"margin-top: 0; margin-bottom: 0; padding-inline-start: 48px;\"><li dir=\"ltr\" style=\"list-style-type: disc; font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre;\" aria-level=\"1\"><p dir=\"ltr\" style=\"line-height: 1.38; background-color: #ffffff; margin-top: 9pt; margin-bottom: 0pt;\" role=\"presentation\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">For a <\/span><a style=\"text-decoration: none;\" href=\"https:\/\/cloud.google.com\/looker\/docs\/derived-tables#native_derived_tables\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #1155cc; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: underline; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;\">native derived table<\/span><\/a><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">, you define the derived table with a LookML-based query.<\/span><\/p><\/li><li dir=\"ltr\" style=\"list-style-type: disc; font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre;\" aria-level=\"1\"><p dir=\"ltr\" style=\"line-height: 1.38; background-color: #ffffff; margin-top: 0pt; margin-bottom: 9pt;\" role=\"presentation\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">For a <\/span><a style=\"text-decoration: none;\" href=\"https:\/\/cloud.google.com\/looker\/docs\/derived-tables#sql-based_derived_tables\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #1155cc; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: underline; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;\">SQL-based derived table<\/span><\/a><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">, you define the derived table with a SQL query.<\/span><\/p><\/li><\/ul><p><b id=\"docs-internal-guid-69c65c33-7fff-4e9b-0733-563ae4dc8dcf\" style=\"font-weight: normal;\">\u00a0<\/b><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #1f1f1f; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">Here are more resources about Derived tables in Looker:<\/span><\/p><ul style=\"margin-top: 0; margin-bottom: 0; padding-inline-start: 48px;\"><li dir=\"ltr\" style=\"list-style-type: disc; font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #1f1f1f; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre;\" aria-level=\"1\"><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\" role=\"presentation\"><a style=\"text-decoration: none;\" href=\"https:\/\/cloud.google.com\/looker\/docs\/derived-tables\"><span style=\"font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #1155cc; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: underline; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;\">Derived tables in Looker<\/span><\/a><\/p><\/li><\/ul><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 17pt; font-family: 'Google Sans',sans-serif; color: #3c4043; background-color: #ffffff; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">Using sql runner to test derived tables<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #3c4043; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">If you see an error coming from a derived table, you can determine the cause of the error by copying the SQL statement into SQL Runner and gradually narrow down the query to identify the problem code. For example, let\u2019s say I have a derived table defined like this:<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #3c4043; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">LookML<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #3c4043; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"><span style=\"border: none; display: inline-block; overflow: hidden; width: 322px; height: 284px;\"><img fetchpriority=\"high\" decoding=\"async\" style=\"margin-left: 0px; margin-top: 0px;\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdeqdFO8WWmPPansE5g-HIt94CQouzyyCA4Xl46P1bEYStHTSJ1jOHBulOz9DxD0oPsay-kW4DLymyQmtmNV7kRR0V4Ub2zFmbpcQV1sv0ndhcFynuDg_WFhM8NZ3uVuIM4tewd-uwVLs1n5V45WY7coeLB?key=-44z_xPtw5kA3EK_JMRDFA\" width=\"322\" height=\"284\" \/><\/span><\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #616161; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">When I queried it, I got this message:<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #3c4043; background-color: #d9d9d9; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">temp derived_table user_order_facts creation failed: SQL Error in CREATE TABLE as SELECT: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">To track down where the issue is coming from, we can open the query in SQL Runner by clicking the SQL tab and selecting \u201copen in SQL Runner.\u201d We now have the query open in SQL Runner and can start troubleshooting:<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">If your derived table is persisted or exists on an a dialect that creates temporary tables, start by commenting out any create statements.<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">Also, SQL Runner can only run one select statement at once so comment out any extra queries. This leaves us with:<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"><span style=\"border: none; display: inline-block; overflow: hidden; width: 464px; height: 294px;\"><img decoding=\"async\" style=\"--smush-placeholder-width: 464px; --smush-placeholder-aspect-ratio: 464\/294;margin-left: 0px; margin-top: 0px;\" data-src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXd8tKa0McxVpblCHPYGqgms4eIEWFG_gBXyUtbTD6IjvlJ5RJWFLFUAnkhT0w-vcSvQVGJ-QT6RIRxd0UBMYDm-E2Tpkw8WjuKGmSBOHvgt7jEUTrK2JzPOjwGtPCUAmn3tLY4saoHAgQ7oK5OTcx33HW8h?key=-44z_xPtw5kA3EK_JMRDFA\" width=\"464\" height=\"294\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" \/><\/span><\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #616161; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">From here, we can start commenting out sections until we narrow it down to a few lines of code. For example, in this case the error message mentions the syntax issue being near the \u2018from order_items\u2019 so I might start by checking the subquery.<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #616161; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\"><span style=\"border: none; display: inline-block; overflow: hidden; width: 386px; height: 163px;\"><img decoding=\"async\" style=\"--smush-placeholder-width: 386px; --smush-placeholder-aspect-ratio: 386\/163;margin-left: 0px; margin-top: 0px;\" data-src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXfHjpk7wmXvokrGTmRoyJt5S_qZMkbkadskqUY4dJeCoPLA1R5Din3E2vc1xqc6ExT--RMkBBFNch120vRV0qUgYiuDSg3H5GjfcKMTQjVjm3yGPzLSKuVPX3_L7_TMAEfwOYhNFDsIGd3hcu_wsumeslh_?key=-44z_xPtw5kA3EK_JMRDFA\" width=\"386\" height=\"163\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" \/><\/span><\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">I see that this simpler query is still generating an error. Upon closer inspection, I see that the extra comma after sale_price is causing the errors.<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">Removing this allows the entire query to run successfully, so we know that this was causing our explore to generate an error. We can now adjust our derived table view to reflect this change and see that the explore returns without error.<\/span><\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: Roboto,sans-serif; color: #202124; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">If your simpler query does not generate the error, gradually add back in parts of your original query to find what part of the original query caused the error.<\/span><\/p><p>\u00a0<\/p><p dir=\"ltr\" style=\"line-height: 1.38; margin-top: 12pt; margin-bottom: 12pt;\"><span style=\"font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #1f1f1f; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">Resources: <\/span><a style=\"text-decoration: none;\" href=\"https:\/\/www.googlecloudcommunity.com\/gc\/Modeling\/Using-sql-runner-to-test-derived-tables\/td-p\/576581\"><span style=\"font-size: 12pt; font-family: 'Google Sans',sans-serif; color: #1155cc; background-color: #ffffff; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: underline; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;\">Using sql runner to test derived tables<\/span><\/a><\/p><div>\u00a0<\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"featured_media":6643,"template":"","meta":{"postBodyCss":"","postBodyMargin":[],"postBodyPadding":[],"postBodyBackground":{"backgroundType":"classic","gradient":""},"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[18],"tags":[82,79],"class_list":["post-6612","blog","type-blog","status-publish","has-post-thumbnail","hentry","category-blog","tag-sql","tag-sql-runner"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.4 (Yoast SEO v26.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728 - Admazes - Innovative Marketing &amp; Technology Solutions that Drive Business Values<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728\" \/>\n<meta property=\"og:description\" content=\"Using SQL Runner to check errors in derived tables In L &hellip; Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728 \u67e5\u770b\u5168\u6587 &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/\" \/>\n<meta property=\"og:site_name\" content=\"Admazes - Innovative Marketing &amp; Technology Solutions that Drive Business Values\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/admazes\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-07T03:07:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/admazes.com\/wp-content\/uploads\/2024\/04\/Spot-and-fix-errors-in-your-derived-tables-effortlessly-with-SQL-Runner-\ud83d\udee0\ufe0f\u2728.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/\",\"url\":\"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/\",\"name\":\"Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728 - Admazes - Innovative Marketing &amp; Technology Solutions that Drive Business Values\",\"isPartOf\":{\"@id\":\"https:\/\/admazes.com\/zh-hans\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/admazes.com\/wp-content\/uploads\/2024\/04\/Spot-and-fix-errors-in-your-derived-tables-effortlessly-with-SQL-Runner-\ud83d\udee0\ufe0f\u2728.png\",\"datePublished\":\"2024-04-10T02:00:00+00:00\",\"dateModified\":\"2025-01-07T03:07:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/#primaryimage\",\"url\":\"https:\/\/admazes.com\/wp-content\/uploads\/2024\/04\/Spot-and-fix-errors-in-your-derived-tables-effortlessly-with-SQL-Runner-\ud83d\udee0\ufe0f\u2728.png\",\"contentUrl\":\"https:\/\/admazes.com\/wp-content\/uploads\/2024\/04\/Spot-and-fix-errors-in-your-derived-tables-effortlessly-with-SQL-Runner-\ud83d\udee0\ufe0f\u2728.png\",\"width\":1080,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/admazes.com\/zh-hans\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/admazes.com\/zh-hans\/#website\",\"url\":\"https:\/\/admazes.com\/zh-hans\/\",\"name\":\"Admazes - Innovative Marketing & Technology Solutions that Drive Business Values\",\"description\":\"Official Website\",\"publisher\":{\"@id\":\"https:\/\/admazes.com\/zh-hans\/#organization\"},\"alternateName\":\"Admazes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/admazes.com\/zh-hans\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/admazes.com\/zh-hans\/#organization\",\"name\":\"Admazes\",\"url\":\"https:\/\/admazes.com\/zh-hans\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/admazes.com\/zh-hans\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/admazes.com\/wp-content\/uploads\/2024\/05\/Admazes_Logo_outline-1.png\",\"contentUrl\":\"https:\/\/admazes.com\/wp-content\/uploads\/2024\/05\/Admazes_Logo_outline-1.png\",\"width\":7200,\"height\":2000,\"caption\":\"Admazes\"},\"image\":{\"@id\":\"https:\/\/admazes.com\/zh-hans\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/admazes\",\"https:\/\/www.linkedin.com\/company\/admazes\",\"https:\/\/www.instagram.com\/admazes\/\"],\"description\":\"Admazes is an award-winning MarTech, Data and AI agency based in Hong Kong. We help brands grow with data-driven marketing, Google Cloud, GA4 analytics, and AI solutions. Certified Google Cloud Partner trusted by leading brands across Asia since 2019.\",\"foundingDate\":\"2019-07-02\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728 - Admazes - Innovative Marketing &amp; Technology Solutions that Drive Business Values","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/","og_locale":"zh_CN","og_type":"article","og_title":"Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728","og_description":"Using SQL Runner to check errors in derived tables In L &hellip; Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728 \u67e5\u770b\u5168\u6587 &raquo;","og_url":"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/","og_site_name":"Admazes - Innovative Marketing &amp; Technology Solutions that Drive Business Values","article_publisher":"https:\/\/www.facebook.com\/admazes","article_modified_time":"2025-01-07T03:07:11+00:00","og_image":[{"width":1080,"height":1080,"url":"https:\/\/admazes.com\/wp-content\/uploads\/2024\/04\/Spot-and-fix-errors-in-your-derived-tables-effortlessly-with-SQL-Runner-\ud83d\udee0\ufe0f\u2728.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/","url":"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/","name":"Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728 - Admazes - Innovative Marketing &amp; Technology Solutions that Drive Business Values","isPartOf":{"@id":"https:\/\/admazes.com\/zh-hans\/#website"},"primaryImageOfPage":{"@id":"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/#primaryimage"},"image":{"@id":"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/#primaryimage"},"thumbnailUrl":"https:\/\/admazes.com\/wp-content\/uploads\/2024\/04\/Spot-and-fix-errors-in-your-derived-tables-effortlessly-with-SQL-Runner-\ud83d\udee0\ufe0f\u2728.png","datePublished":"2024-04-10T02:00:00+00:00","dateModified":"2025-01-07T03:07:11+00:00","breadcrumb":{"@id":"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/#primaryimage","url":"https:\/\/admazes.com\/wp-content\/uploads\/2024\/04\/Spot-and-fix-errors-in-your-derived-tables-effortlessly-with-SQL-Runner-\ud83d\udee0\ufe0f\u2728.png","contentUrl":"https:\/\/admazes.com\/wp-content\/uploads\/2024\/04\/Spot-and-fix-errors-in-your-derived-tables-effortlessly-with-SQL-Runner-\ud83d\udee0\ufe0f\u2728.png","width":1080,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/admazes.com\/zh-hans\/blog\/spot-and-fix-errors-in-your-derived-tables-effortlessly-with-sql-runner-%f0%9f%9b%a0%ef%b8%8f%e2%9c%a8\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/admazes.com\/zh-hans\/"},{"@type":"ListItem","position":2,"name":"Spot and fix errors in your derived tables effortlessly with SQL Runner! \ud83d\udee0\ufe0f\u2728"}]},{"@type":"WebSite","@id":"https:\/\/admazes.com\/zh-hans\/#website","url":"https:\/\/admazes.com\/zh-hans\/","name":"Admazes - Innovative Marketing & Technology Solutions that Drive Business Values","description":"Official Website","publisher":{"@id":"https:\/\/admazes.com\/zh-hans\/#organization"},"alternateName":"Admazes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/admazes.com\/zh-hans\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"https:\/\/admazes.com\/zh-hans\/#organization","name":"Admazes","url":"https:\/\/admazes.com\/zh-hans\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/admazes.com\/zh-hans\/#\/schema\/logo\/image\/","url":"https:\/\/admazes.com\/wp-content\/uploads\/2024\/05\/Admazes_Logo_outline-1.png","contentUrl":"https:\/\/admazes.com\/wp-content\/uploads\/2024\/05\/Admazes_Logo_outline-1.png","width":7200,"height":2000,"caption":"Admazes"},"image":{"@id":"https:\/\/admazes.com\/zh-hans\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/admazes","https:\/\/www.linkedin.com\/company\/admazes","https:\/\/www.instagram.com\/admazes\/"],"description":"Admazes is an award-winning MarTech, Data and AI agency based in Hong Kong. We help brands grow with data-driven marketing, Google Cloud, GA4 analytics, and AI solutions. Certified Google Cloud Partner trusted by leading brands across Asia since 2019.","foundingDate":"2019-07-02"}]}},"_links":{"self":[{"href":"https:\/\/admazes.com\/zh-hans\/wp-json\/wp\/v2\/blog\/6612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/admazes.com\/zh-hans\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/admazes.com\/zh-hans\/wp-json\/wp\/v2\/types\/blog"}],"version-history":[{"count":0,"href":"https:\/\/admazes.com\/zh-hans\/wp-json\/wp\/v2\/blog\/6612\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/admazes.com\/zh-hans\/wp-json\/wp\/v2\/media\/6643"}],"wp:attachment":[{"href":"https:\/\/admazes.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=6612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/admazes.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=6612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/admazes.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=6612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}