Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good day!
I have simple table:
Field1 | Field2 | Field3 | Field4 |
12 | 0 | 12 | 54 |
23 | 7 | 444 | 32 |
43 | 55 | 5 | 6445 |
12 | 435 | 43534 | 4 |
122 | 2 | 444 | 35 |
My task is to write SQL select query, which must get me rows, for which quantity of worked conditions=2
and only those records, for which quantity of worked below conditions=2:
1. Field1>Field2
2. Field3=444
3. Field4>32
In result i need get only first 2 records:
Field1 | Field2 | Field3 | Field4 |
12 | 0 | 12 | 54 |
23 | 7 | 444 | 32 |
Thanks.
May be this? I am not sure why you want Field3 - 12 in the result, Because we are filtering the only 444 from that table?
Load Field1, Field2, Field3, Field4 Where Field1 > Field2 and Field3 = 444 and Field4 > 32;
LOAD * Inline [
Field1, Field2, Field3, Field4
12, 0, 12, 54
23, 7, 444, 32
43, 55, 5, 6445
12, 435, 43534, 4
122, 2, 444, 35
];
Thanks.
But it must be not scripting code from QV. I need SQL query.
Query must check each records and quantity conditions for each of them which are working.
If quantity of working conditions for some record =2, it must be shown in result table.
Please give proper name for your field then it will help us to give reply.
I am sorry, We are in Qlik Forum. Move to DB Forum
FYI, This should work in SQL Engine
SELECT Field1, Field2, Field3, Field4 From TableName Where Field1 > Field2 and Field3 = 444 and Field4 > 32;
Field1 Field2 Field3 Field4 12 0 12 54 23 7 444 32 Thanks.
For this you can simply write
select Field1,Field2,Field3,Field4
from tablename
where Field1 in (12,23);