Comments (6)
pgsql:
SELECT ods_day,
modified,
task_code,
transaction_code,
CAST(content AS JSON) ->> '$.eventType' AS eventType,
CAST(content AS JSON) ->> '$.unionCodeResults' AS unionCodeResults
FROM edw_f_zone.gugu_yf_transaction_detail_dd
WHERE transaction_label = 'unioncodelist'
AND CAST(ods_day AS DATE) = '20240505';
from sqlglot.
mysql:
SELECT ods_day, modified, task_code, transaction_code, CAST(content AS JSON) ->> '$."$.eventType"' AS eventType, CAST(content AS JSON) ->> '$."$.unionCodeResults"' AS unionCodeResults FROM edw_f_zone.gugu_yf_transaction_detail_dd WHERE transaction_label = 'unioncodelist' AND CAST(ods_day AS DATE) = '20240505'
from sqlglot.
more,pgsql:
SELECT
SUBSTR(CAST((CAST('2024-04-15' AS DATE) + INTERVAL '1 month ago') AS varchar), 1,7);
mysql:
SELECT
SUBSTR(CAST((CAST('2024-04-15' AS DATE) + INTERVAL '1 month ago') AS varchar), 1,7);
from sqlglot.
pgsql:`select *
from (select 1 as obs,
substring((current_time - interval '16 min') ::text, 1, 2) as value
,
(substring(current_time::text, 1, 2)::integer) || '>点' as name
union all
select 2 as obs,
unnest(array['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24']) as value
,
unnest(array['0点','1点','2点','3点','4点','5点','6点','7点','8点','9点','10点','11点','12点','13点','14点','15点','16点','17点','18点','19点','20点','21点','22点','23点','24点']) as name) a
order by 1;`
mysql:SELECT * FROM (SELECT 1 AS obs, SUBSTRING(CAST((CURRENT_TIME() - INTERVAL '16' MIN) AS STRING), 1, 2) AS value, (CAST(SUBSTRING(CAST(CURRENT_TIME() AS STRING), 1, 2) AS INT)) || '>点' AS name UNION ALL SELECT 2 AS obs, EXPLODE(ARRAY('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24')) AS value, EXPLODE(ARRAY('0点', '1点', '2点', '3点', '4点', '5点', '6点', '7点', '8点', '9点', '10点', '11点', '12点', '13点', '14点', '15点', '16点', '17点', '18点', '19点', '20点', '21点', '22点', '23点', '24点')) AS name) AS a ORDER BY 1;
from sqlglot.
pgsql:
select t1.rc_month, t2.id::varchar||'-'::varchar||t2.code_value overdue_reason,count(distinct loan_id) cnt from sherlock.t_dwp_jxj_bp_collect_record_rucui_trans_base t1 left join sherlock.t_overdue_reason_code t2 on t1.overdue_reason::bigint = t2.id WHERE t1.overdue_reason:: bigint not in (0 , 1 , 2 , 27) and rc_month is not null and ods_day<=to_char(due_date +interval '1 months' , 'YYYYmmdd') group by 1, 2
mysql:
SELECT t1.rc_month, CAST(t2.id AS VARCHAR) || CAST('-' AS VARCHAR) || t2.code_value AS overdue_reason, COUNT(DISTINCT loan_id) AS cnt FROM sherlock.t_dwp_jxj_bp_collect_record_rucui_trans_base AS t1 LEFT JOIN sherlock.t_overdue_reason_code AS t2 ON CAST(t1.overdue_reason AS BIGINT) = t2.id WHERE NOT CAST(t1.overdue_reason AS BIGINT) IN (0, 1, 2, 27) AND NOT rc_month IS NULL AND ods_day <= DATE_FORMAT(due_date + INTERVAL '1' MONTHS, '%Ymmdd') GROUP BY 1, 2;
from sqlglot.
more,
postgres:
select before_first_due_date::date + ((installment_count::int - 1) || ' month')::interval as clear_date from edw_dws.dws_unionloan_zhanqi_loan_df;
mysql:
SELECT CAST(before_first_due_date AS DATE) + CAST(((CAST(installment_count AS INT) - 1) || ' month') AS INTERVAL) AS clear_date FROM edw_dws.dws_unionloan_zhanqi_loan_df;
from sqlglot.
Related Issues (20)
- tSQL If condition ParseError HOT 1
- Improve pretty-printing for `CASE WHEN .. THEN ..` expressions HOT 1
- Prefix comments with `--` when pretty-printing whole-line comments HOT 1
- DuckDB base text types incorrect HOT 7
- Support ALTER VIEW in expression HOT 3
- Issue parsing `gen_random_uuid()` in postgres script.
- Support parsing of comma separated alter table clauses (snowflake) HOT 1
- Incorrect type cast in conversion from Spark to Presto in timestampad function HOT 2
- NULLS FIRST added to ORDER BY with oracle dialect. At least it should be NULLS LAST when sort direction is not provided. HOT 1
- Parsing falls back to Command when using BEGIN in BigQuery multi-statement HOT 1
- SAS dialect HOT 1
- duckdb binder error after json_extract_string is converted to ->> HOT 2
- `CREATE INDEX CONCURRENTLY` not parsed by postgres dialect
- dialect: postgres, `CREATE AGGREGATE` and `CREATE EXTENSION` treated as invalid syntax, unsure if expected or bug. HOT 7
- INSERT incorrectly roundtripped in mysql dialect.
- generate_series() is not transpiled to sequence() when going from duckdb to spark sql
- transpile removes some comments HOT 1
- Trino/Presto parsing allowing invalid syntax HOT 1
- Time format for Spark to Presto conversion of unix_timestamp not inclusive of microseconds HOT 7
- Transpile not working for postgres/duckdb HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlglot.