Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select problem
Message
From
01/08/2000 18:44:49
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00398108
Message ID:
00399654
Views:
25
>Hi Brien,
>I prefer the Jim's way because the user can generate the SQL SELECT by using values from the different tables. I send here the very easy sample to describe my problemm.
>In that table user can input not only languages but type of scool, the qualifications etc. etc. so I made some sort of query maker which gives to user pissibilities to make deifferent reports from this table. So I don't know how many times I need to slef-link table.
>
>Boris

Hi:

PMFJI (Just learned what that means and this is first time I've had a chance to use it)

If the users can
1. Pick the field they want to compare on (sel_field)
2. Pick the values they want to check for ("English", "French")

and assuming that the user wants to find people with all the skills selected

you might try something like:

cField = (Field Name the User Picked)
DIME aCheckVals[N] && Populate aCheckVals with the list of items

SELECT name FROM people ;
WHERE ASCAN(aCheckVals,&cField) > 0;
GROUP BY name HAVING COUNT(*) = ALEN(aCheckVals)



You could easily modify this query to get all with some number of the skills (2 of 3 requested languages, for example)



On large tables this query might be too slow, but it should be generic enough to work in most cases.


HTH................Rich
Previous
Reply
Map
View

Click here to load this message in the networking platform