Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

allow select from a union select#53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
chack-os wants to merge2 commits intoJavaScriptor:master
base:master
Choose a base branch
Loading
fromchack-os:master
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionssrc/sqlParser.jison
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -587,6 +587,7 @@ index_hint
table_factor
: identifier partitionOpt aliasOpt index_hint_list_opt { $$ = { type: 'TableFactor', value: $1, partition: $2, alias: $3.alias, hasAs: $3.hasAs, indexHintOpt: $4 } }
| '(' selectClause ')' aliasOpt { $$ = { type: 'TableFactor', value: { type: 'SubQuery', value: $2 }, alias: $4.alias, hasAs: $4.hasAs} }
| '(' unionClauseNotParenthesized ')' aliasOpt { $$ = { type: 'TableFactor', value: { type: 'SubQuery', value: $2 }, alias: $4.alias, hasAs: $4.hasAs} }
| '(' table_references ')' { $$ = $2; $$.hasParentheses = true }
;
place_holder
Expand Down
41 changes: 41 additions & 0 deletionstest/main.test.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -436,4 +436,45 @@ describe('select grammar support', function () {
it('test IDENTIFIER', function () {
testParser('select `aa#sfs`(a) as \'A A\' from z');
});

it('test from with union select', function (){
testParser(`select
(select min(actividad)
from
( select client_id,
(select code_description from m_code_value where code_id =61 and id=LActividadEconomica_cd_own_business_main_activity) actividad,
estimated_amount_income_employer monto
from m_clientDetalleNegocios
union all
select client_id,
(select code_description from m_code_value where code_id =47 and id=Ltipoingreso_cd_income_type) actividad , other_incomes_estimated_amount monto
from m_clientDetalleOtrosIngresos
union all
select client_id, case r.Lsector_cd_Sector when 154 then 755 else 754 end actividad,
r.estimated_incomes_amount monto
from m_clientDetalleRelLaboral r
) actividades
where monto =
( select max(monto)
from
(
select client_id,
(select code_description
from m_code_value where code_id =61 and id=LActividadEconomica_cd_own_business_main_activity) actividad, estimated_amount_income_employer monto
from m_clientDetalleNegocios
union all
select client_id,
(select code_description from m_code_value where code_id =47 and id=Ltipoingreso_cd_income_type) actividad , other_incomes_estimated_amount monto
from m_clientDetalleOtrosIngresos
union all
select client_id, case r.Lsector_cd_Sector when 154 then 755 else 754 end actividad, r.estimated_incomes_amount monto
from m_clientDetalleRelLaboral r
) maxact
where client_id = actividades.client_id
)
and client_id =cli.id
) as c55017
from m_client cli`)
})

});

[8]ページ先頭

©2009-2025 Movatter.jp