Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

script problem

Dear All,

How to user this SQL query in qlikview script :

Select Level00,

  Level02,

(

  SELECT TOP 1 Level2

  FROM demo m

  WHERE m.ProductCode = tb.ProductCode

  AND (

  m.StoreCode = sm.StoreCode

  OR m.StoreCode IS NULL

  )

  AND m.CreatedDate <= tb.CreatedOn

  ELSE 1 END)

  ORDER BY m.CreatedDate DESC

  ) AS 'Level2'

FROM dbo.User(NOLOCK) umr

INNER JOIN tempDemo tb ON tb.ModuleID = srm.ModuleID

Please reply..

Rahul

4 Replies
crusader_
Partner - Specialist
Partner - Specialist

Hi,

Create ODBC (OLE DB) connection to your database.

And use below script:

Table:

LOAD *

;

SQL

Select Level00,

  Level02,

(

  SELECT TOP 1 Level2

  FROM demo m

  WHERE m.ProductCode = tb.ProductCode

  AND (

  m.StoreCode = sm.StoreCode

  OR m.StoreCode IS NULL

  )

  AND m.CreatedDate <= tb.CreatedOn

  ELSE 1 END)

  ORDER BY m.CreatedDate DESC

  ) AS 'Level2'

FROM dbo.User(NOLOCK) umr

INNER JOIN tempDemo tb ON tb.ModuleID = srm.ModuleID;

Hope this helps.

Regards,

Andrei Kaliahin

Not applicable
Author

thanks for reply but i am working on qvd so i have to create logic .

I can't fetch this from DB.

crusader_
Partner - Specialist
Partner - Specialist

Hm...

So each table from DB converted into QVD ?

Am I right?

Andrei

Not applicable
Author

yes...