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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
timsaddler
Creator III
Creator III

Left,Right,Index

Hi All

Need to extract data from a field being pulled from a sql server 2005 db - whatever i try doesn't work!

Any suggestions gratefully received. Script below

 

SQL


SELECT
T1.ID,
T1.Mon_ID,
T3.Title,
T1.Reading_Date,
T1.Site_ID,
T2.Name,
Left(T2,Name,3),
T1.Value

FROM "Envoy_Live".dbo.Mon_Reading T1

inner join "Envoy_Live".dbo.Site T2
on T1.Site_ID = T2.ID

inner join "Envoy_Live".dbo.Mon T3
on T1.Mon_ID = T3.ID

where Year(T1.Reading_Date) = 2012
and T3.ID in (948, 947, 946, 945, 944, 943, 951, 950, 949)

Labels (1)
1 Solution

Accepted Solutions
Anonymous
Not applicable

You cannot use QV functions in SQL - it doesn't understand...  Use preceeding load, where you can use QV functions:

LOAD
...
Left(Name,3) as ...,
...
;
SQL
SELECT
T1.ID,
T1.Mon_ID,
T3.Title,
T1.Reading_Date,
T1.Site_ID,
T2.Name,
T1.Value

Regards,
Michael

View solution in original post

2 Replies
Anonymous
Not applicable

You cannot use QV functions in SQL - it doesn't understand...  Use preceeding load, where you can use QV functions:

LOAD
...
Left(Name,3) as ...,
...
;
SQL
SELECT
T1.ID,
T1.Mon_ID,
T3.Title,
T1.Reading_Date,
T1.Site_ID,
T2.Name,
T1.Value

Regards,
Michael

timsaddler
Creator III
Creator III
Author

Thanks Michael - that pointed me in the right direction to correct my mistake.