Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have two tables with columns:
Table1: Table2:
bdesc bdesc
userName userName
date
I know I can load them both by renaming one column so that there is only one key and no synthetic key but I want to learn to use Qualify.
Hope someone can help me understand Qualify, as I have other tables with same columns where I can't rename them all.
Example:
Qualify userName ;
Load bdesc ,userName from x.csv;
Load bdesc ,username, date from y.csv;
The two tables x.csv and y.csv are associated only through A.
The fields will result: bdesc, date , x.userName , y.userName .
The learning should start from the qv help itself:
From help:
The Qualify statement is used for switching on the
qualification of field names, i.e. field names will get the table name as a
prefix.The automatic association of fields with the same name in different tables
can be suspended by means of the qualify statement,
which qualifies the field name with its table name. If qualified, the field
name(s) will be renamed when found in a table. The new name will be in the form
of tablename.fieldname. Tablename is equivalent to the label of the current table,
or, if no label exists, to the name appearing after from
in load and select statements.The qualification will be made for all fields loaded after the Qualify statement.
Note!
The qualify statement should not be used in conjunction with
partial reload!Qualification is always turned off by default at the beginning of script
execution. Qualification of a field name can be activated at any time using a
qualify statement. Qualification can be turned off at
any time using an unqualify statement.The syntax is:
qualify *fieldlist
*fieldlist is a comma separated list of the fields
for which qualification should be turned on. Using * as field list indicates all
fields. The wildcard characters * and ? are allowed in field names. Quoting of
field names may be necessary when wildcards are used.Examples:
Qualify B;
Load A,B from x.csv;
Load A,B from y.csv;
The two tables x.csv and y.csv are associated only through A.
Three fields will result: A, x.B, y.B.In an unfamiliar database, it is often useful to start out by making sure
that only one or a few fields are associated, as illustrated in this
example:qualify *;
unqualify TransID;
select * from tab1;
select * from tab2;
select * from tab3;
Only TransID will be used
for associations between the tables tab1, tab2 and tab3.
Example:
Qualify userName ;
Load bdesc ,userName from x.csv;
Load bdesc ,username, date from y.csv;
The two tables x.csv and y.csv are associated only through A.
The fields will result: bdesc, date , x.userName , y.userName .
Hi
Try like this
Qualify *;
Unqualify ID; // by using this, you can join tableA and tableB by ID field
Load ID, Name, description from TableA;
Load ID, Name, description from TableB;
thanks
thanks