Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Xolink1389
Creator
Creator

LOOK THE SAME FIELD ON THE SAME SQL CONSULT

hello

USR01: LOAD * WHERE 1=2; SQL SELECT * FROM USR01;
USR02: LOAD * WHERE 1=2; SQL SELECT * FROM USR02;
USR06: LOAD * WHERE 1=2; SQL SELECT * FROM USR06;
USR11: LOAD * WHERE 1=2; SQL SELECT * FROM USR11;
USR21: LOAD * WHERE 1=2; SQL SELECT * FROM USR21;
UST04: LOAD * WHERE 1=2; SQL SELECT * FROM UST04;

a made this consult but i wanna make it more short, all this table contain a field name BURKS so i wanna add a general WHERE for all this table, instead of add a where on each consult, its possible?,

i mean if  BURKS=1000 i want it search on the six consults  all the field where burks is equal to 1000, why i wanna make it? cause i have like a 50 diferents consults with diferent table names and i dont want to put a where on each one

Labels (4)
1 Reply
henrikalmen
Specialist
Specialist

This is possibly what you want:

SUB getdata(tbl)
  [$(tbl)]: 
    load * where 1=2;
    SQL select * from $(tbl);
END SUB

FOR each tablename in 'USR01', 'USR02'
  call getdata('$(tablename)');
NEXT