Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I need to translate this SQL statement:
SELECT Customerid ,
Sum(amount)
From Orders
group by Customerid
having max(orderdate)
thanks
No. The first step is the SELECT statement. It produces three fields: Customerid, Amount, and MaxOrderDate. The second step is the preceding load. It can only "see" these three fields, so the field OrderDate is not available.
But you can do what I suggested in my previous answer: Use MaxOrderDate in a comparison.
See also Preceding Load
HIC
I think you miss the bold part in the sql statement
SELECT Customerid ,
Sum(amount)
From Orders
group by Customerid
having max(orderdate) > something
there is no need to translate the statement in Qlik, usually you can also use your sql in QlikView script
SQL
SELECT Customerid ,
Sum(amount)
From Orders
group by Customerid
having max(orderdate) > something;
thak you very much
Just as maxgro says, you can send the entire SELECT statement as-is to the ODBC driver. This is probably the best solution.
However, an alternative method is to use a preceding load:
Load * Where MaxOrderDate > something;
SQL SELECT
Customerid,
Sum(amount) as Amount,
Max(orderdate) as MaxOrderDate
From Orders
group by Customerid ;
HIC
can i do that?
Load * Where OrderDate = max(OrderDate);
SQL SELECT
Customerid,
Sum(amount) as Amount,
Max(orderdate) as MaxOrderDate
From Orders
group by Customerid ;
thank's
No. The first step is the SELECT statement. It produces three fields: Customerid, Amount, and MaxOrderDate. The second step is the preceding load. It can only "see" these three fields, so the field OrderDate is not available.
But you can do what I suggested in my previous answer: Use MaxOrderDate in a comparison.
See also Preceding Load
HIC