Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Views
Message
From
30/01/2001 23:12:05
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Views
Miscellaneous
Thread ID:
00470514
Message ID:
00470514
Views:
64
I have a view

SELECT SUM(IIF(.NOT.EMPTY(Subscriber.c_premiumproduct_id),1,0)) AS getpremiumproduct,;
SUM(IIF(EMPTY(Subscriber.c_premiumproduct_id),1,0)) AS dontgetpremiumproduct;
FROM subscription!subscriber FULL JOIN subscription!gifts ;
ON Subscriber.c_id = Gifts.c_id;
WHERE Subscriber.c_id <> Gifts.c_id;
AND (Subscriber.i_last_issue_sent=0 = .T.;
AND Subscriber.l_paid = .T.;
AND Subscriber.i_renewals = 0;
AND Subscriber.l_online_subscriber = .F.;
AND Subscriber.c_region = ?c_region_id;
AND Subscriber.l_start_with_next_issue = .F.;
AND Subscriber.l_cancel = .F.)

In this particular case I have two tables a subscriber table and a giver table. I only want to select those records which don't have a matching record in the giver table; therefore where subscriber.c_id <> gifts.c_id. Is this the best way to handle this. Also I am trying to optimize the select in which I have created an index for each of where clause with the exception of the subscriber.c_id <> gifts.c_id. However each of the tables do have a index on the c_id. One thing I haven't done however is to create an index on deleted(). I am just wondering if I have provided enough for this to be optimized and execute as fast as possible.
Next
Reply
Map
View

Click here to load this message in the networking platform