Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Trying to limit data pull with where statement
it works with just this Where FGName = 'Bria Management'
But when I add the AND nothing comes over or it errors out
[FacGroupDefs]:
LIB CONNECT TO [pharmoresql production (pharmore_rwinkel)];
LOAD FGID,
FGName;
SQL SELECT FGID,
FGName
FROM "Fac"."dbo"."FacGroupDefs"
Where FGName = 'Bria Management'
AND FGName = 'Carr'
AND FGName = 'DAAS Management';
A single input record can't show different values in a field at once. I think you are looking for an OR logic;
Where FGName = 'Bria Management'
OR FGName = 'Carr'
OR FGName = 'DAAS Management';
edit:
Alternatively, you can use Match():
...
WHERE Match(FGName, 'Bria Management','Carr','DAAS Management');
Just to clarify the OP, the Where Match statement will go in the preceding load statement rather than the SQL Select statement
[FacGroupDefs]:
LIB CONNECT TO [pharmoresql production (pharmore_rwinkel)];
LOAD FGID,
FGName
WHERE Match(FGName, 'Bria Management','Carr','DAAS Management');
SQL SELECT FGID,
FGName
FROM "Fac"."dbo"."FacGroupDefs";
But this would require to bring in unnecessary data through SQL which you will remove in the preceding load. So, I think it would be better to restrict in your SQL statement using OR method that Stefan has pointed out or use another similar approach.
Hi Robert,
Use OR instead of AND in Where condition.
Ishan
Right, I've overlooked the SQL statement.
You can use the IN operator in SQL to do the same:
...
WHERE FGName IN ('Bria Management','Carr','DAAS Management');