Hello all, and thanks for reading/helping!

I am currently programming in VS (vb.net) a program that will essentially be an interface between users and a database where the users have no idea how to write SQL queries.

In other words, when the user opens the program, he will have a lot of options to select what type of info he wants from the server.

Ex:

Say the Database contains students. The interface will enable the user to select which info he wants, the program will then create the proper query and collect the info from server.

Database contains students attributes such as Age, Sexe, First Name, Last Name, income, etc.

I was thinking of making the queries more efficient by giving each attribute a scale of potential return values to then sort the queries and have them done in steps starting with the one that will potentially return the least amount of values.

Age (male/female) would be something like 5 out of 10
Income would be something like 4/10
Age 3/10
Name 1/10

So say the user selects to get the student population from the database who are males over 30 years old (Age), with an income of 10,000$+. The queries would be stepped like:

Query 1: Select the students that are 30yrs + and make a table with data retrieved
Query 2: Starting with the Query 1 population, inner join it with students with income of 10,000$+
Query 3: Starting with the Query 2 population, inner join with the students who are males.

*** note that in this example it's easy and a multi FROM statement SQL would have sufficed, but in my program, it will have more than 400 different tables to get info from and each table contains millions of entries. So making a SQL query with 100+ FROMs would be silly.

The issue I ran into is that I store the result of the 1st query into a local DataTable variable within my VS project. I only have "read-only" access to the oracle server and thus I can'T create a temporary table/view server side to execute the 2nd query, and 3rd, etc.

So basically what I need help with is to find a way to Distribute query between my local DataTable and the oracle server.
- I looked at sp_addlinkedserver but it's way above my level of understanding...
- I'm currently looking to see if I could use the Query 1 cached by the server to run query 2... Not sure if server cashes it or how to achieve this... work in progress...

I think i'll stop here... for now... hopefully I was able to make it clear enough what my goal and problems are.

If anyone has any ideas, suggestions or constructive comments please share!

Thanks!