Rails 利用 Arel 联合多表查询结果

server那点事

User.from(
  Arel::Nodes::TableAlias.new(
    Arel::Table.new('users')
      .project("id, name")
      .union(Arel::Table.new('another_users').project("id, name")
    ), 'users'
  )
)

生成SQL

SELECT  "id", "name" FROM ( SELECT id, name FROM "users" UNION SELECT id, name FROM "another_users" ) "users" WHERE "users"."id" < 10

发表于 2020.06.15


xsjyBldb • 2021-03-27 07:07

1

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

xsjyBldb • 2021-03-27 07:03

555

''||(select 1 from (select pg_sleep(15))x)||'' • 2021-03-27 07:03

555

'||(select 1 from (select pg_sleep(15))x)||' • 2021-03-27 07:03

555

xsjyBldb'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||' • 2021-03-27 07:03

555

i2CX8cC0')) OR 669=(SELECT 669 FROM PG_SLEEP(15))-- • 2021-03-27 07:03

555

3rWYizY3') OR 726=(SELECT 726 FROM PG_SLEEP(15))-- • 2021-03-27 07:03

555

iFXdgWbw' OR 648=(SELECT 648 FROM PG_SLEEP(15))-- • 2021-03-27 07:03

555

eEbVC5qh'; waitfor delay '0:0:15' -- • 2021-03-27 07:03

555

1 waitfor delay '0:0:15' -- • 2021-03-27 07:03

555

(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/ • 2021-03-27 07:03

555

0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z • 2021-03-27 07:03

555

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z • 2021-03-27 07:03

555

if(now()=sysdate(),sleep(15),0) • 2021-03-27 07:03

555

-1" OR 3*2>(0+5+159-159) -- • 2021-03-27 07:03

555

-1" OR 3*2<(0+5+159-159) -- • 2021-03-27 07:03

555

-1" OR 3+159-159-1=0+0+0+1 -- • 2021-03-27 07:03

555

-1" OR 2+159-159-1=0+0+0+1 -- • 2021-03-27 07:03

555

-1' OR 3*2>(0+5+253-253) or 'eUabKlfb'=' • 2021-03-27 07:03

555

-1' OR 3*2<(0+5+253-253) or 'eUabKlfb'=' • 2021-03-27 07:03

555

-1' OR 3+253-253-1=0+0+0+1 or 'eUabKlfb'=' • 2021-03-27 07:03

555

-1' OR 2+253-253-1=0+0+0+1 or 'eUabKlfb'=' • 2021-03-27 07:03

555

-1' OR 3*2>(0+5+642-642) -- • 2021-03-27 07:02

555

-1' OR 3*2<(0+5+642-642) -- • 2021-03-27 07:02

555

-1' OR 3+642-642-1=0+0+0+1 -- • 2021-03-27 07:02

555

-1' OR 2+642-642-1=0+0+0+1 -- • 2021-03-27 07:02

555

-1 OR 3*2>(0+5+111-111) • 2021-03-27 07:02

555

-1 OR 3*2<(0+5+111-111) • 2021-03-27 07:02

555

-1 OR 3+111-111-1=0+0+0+1 • 2021-03-27 07:02

555

-1 OR 2+111-111-1=0+0+0+1 • 2021-03-27 07:02

555

-1 OR 3*2>(0+5+54-54) -- • 2021-03-27 07:02

555

-1 OR 3*2<(0+5+54-54) -- • 2021-03-27 07:02

555

-1 OR 3+54-54-1=0+0+0+1 -- • 2021-03-27 07:02

555

-1 OR 2+54-54-1=0+0+0+1 -- • 2021-03-27 07:02

555

xsjyBldb • 2021-03-27 07:02

555

xsjyBldb • 2021-03-27 07:02

555

xsjyBldb • 2021-03-27 07:02

555

xsjyBldb • 2021-03-27 07:02

555

xsjyBldb • 2021-03-27 07:02

''||(select 1 from (select pg_sleep(15))x)||''

xsjyBldb • 2021-03-27 07:02

'||(select 1 from (select pg_sleep(15))x)||'

xsjyBldb • 2021-03-27 07:02

555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

xsjyBldb • 2021-03-27 07:02

555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

xsjyBldb • 2021-03-27 07:02

3VmCfytM')) OR 121=(SELECT 121 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 07:02

sc4Dqk2s') OR 380=(SELECT 380 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 07:02

twZc8l6S' OR 575=(SELECT 575 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 07:02

-1)) OR 22=(SELECT 22 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 07:02

-5) OR 769=(SELECT 769 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 07:02

-5 OR 768=(SELECT 768 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 07:02

zaYdhu8n'; waitfor delay '0:0:15' --

xsjyBldb • 2021-03-27 07:02

1 waitfor delay '0:0:15' --

xsjyBldb • 2021-03-27 07:02

-1); waitfor delay '0:0:15' --

xsjyBldb • 2021-03-27 07:02

-1; waitfor delay '0:0:15' --

xsjyBldb • 2021-03-27 07:02

(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

xsjyBldb • 2021-03-27 07:02

0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z

xsjyBldb • 2021-03-27 07:02

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z

xsjyBldb • 2021-03-27 07:02

if(now()=sysdate(),sleep(15),0)

xsjyBldb • 2021-03-27 07:02

-1" OR 3*2>(0+5+782-782) --

xsjyBldb • 2021-03-27 07:02

-1" OR 3*2

xsjyBldb • 2021-03-27 07:02

-1" OR 3+782-782-1=0+0+0+1 --

xsjyBldb • 2021-03-27 07:02

-1" OR 2+782-782-1=0+0+0+1 --

xsjyBldb • 2021-03-27 07:02

-1' OR 3*2>(0+5+218-218) or '6arHPtJH'='

xsjyBldb • 2021-03-27 07:02

-1' OR 3*2

xsjyBldb • 2021-03-27 07:02

-1' OR 3+218-218-1=0+0+0+1 or '6arHPtJH'='

xsjyBldb • 2021-03-27 07:02

-1' OR 2+218-218-1=0+0+0+1 or '6arHPtJH'='

xsjyBldb • 2021-03-27 07:02

-1' OR 3*2>(0+5+133-133) --

xsjyBldb • 2021-03-27 07:02

-1' OR 3*2

xsjyBldb • 2021-03-27 07:02

-1' OR 3+133-133-1=0+0+0+1 --

xsjyBldb • 2021-03-27 07:02

-1' OR 2+133-133-1=0+0+0+1 --

xsjyBldb • 2021-03-27 07:02

-1 OR 3*2>(0+5+622-622)

xsjyBldb • 2021-03-27 07:02

-1 OR 3*2

xsjyBldb • 2021-03-27 07:02

-1 OR 3+622-622-1=0+0+0+1

xsjyBldb • 2021-03-27 07:02

-1 OR 2+622-622-1=0+0+0+1

xsjyBldb • 2021-03-27 07:02

-1 OR 3*2>(0+5+846-846) --

xsjyBldb • 2021-03-27 07:02

-1 OR 3*2

xsjyBldb • 2021-03-27 07:02

-1 OR 3+846-846-1=0+0+0+1 --

xsjyBldb • 2021-03-27 07:02

-1 OR 2+846-846-1=0+0+0+1 --

xsjyBldb • 2021-03-27 07:02

555

xsjyBldb • 2021-03-27 07:02

555

xsjyBldb • 2021-03-27 06:54

''||(select 1 from (select pg_sleep(15))x)||''

xsjyBldb • 2021-03-27 06:54

'||(select 1 from (select pg_sleep(15))x)||'

xsjyBldb • 2021-03-27 06:54

'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

xsjyBldb • 2021-03-27 06:54

*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

xsjyBldb • 2021-03-27 06:54

FNsRP2oq')) OR 731=(SELECT 731 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 06:54

kK0mLFSs') OR 54=(SELECT 54 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 06:54

ASSEffBw' OR 494=(SELECT 494 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 06:54

-1)) OR 512=(SELECT 512 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 06:54

-5) OR 284=(SELECT 284 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 06:54

-5 OR 186=(SELECT 186 FROM PG_SLEEP(15))--

xsjyBldb • 2021-03-27 06:54

KKW1FJkE'; waitfor delay '0:0:15' --

xsjyBldb • 2021-03-27 06:54

1 waitfor delay '0:0:15' --

xsjyBldb • 2021-03-27 06:54

-1); waitfor delay '0:0:15' --

xsjyBldb • 2021-03-27 06:54

-1; waitfor delay '0:0:15' --

xsjyBldb • 2021-03-27 06:54

(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

xsjyBldb • 2021-03-27 06:54

0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z

xsjyBldb • 2021-03-27 06:54

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z

xsjyBldb • 2021-03-27 06:54

if(now()=sysdate(),sleep(15),0)

xsjyBldb • 2021-03-27 06:54

RLIKE (SELECT (CASE WHEN (586=586) THEN 1 ELSE 0x28 END)) --

xsjyBldb • 2021-03-27 06:54

-1 OR 3*2>(0+5+141-141)

xsjyBldb • 2021-03-27 06:54

-1 OR 3*2

xsjyBldb • 2021-03-27 06:54

-1 OR 3+141-141-1=0+0+0+1

xsjyBldb • 2021-03-27 06:54

-1 OR 2+141-141-1=0+0+0+1

xsjyBldb • 2021-03-27 06:54

1*

xsjyBldb • 2021-03-27 06:54

1*

xsjyBldb • 2021-03-27 06:54

1*

xsjyBldb • 2021-03-27 06:54

1*

xsjyBldb • 2021-03-27 06:54

8MgJcsCW

xsjyBldb • 2021-03-27 06:52

1