Question about data retrieval from nested SELECT
I have a database in Access and one of my queries has 7 SELECT statements. The problem is that I have multiple inheritance and I have to retrieve information from the super most class and combine it with information from the sub most class but I change the primary key. It looks something like this:
The result from the previous SELECT statments has one nr column and then I have B(*id_U, nr) -> A(data1, data2, id).
So to say, I have in the result some numbers, that corespond to data1 and data2 in A via the nr and id. I have to output nr, data1, data2. How can I do that? I can output only data1 and data2, but how do I add the nr?
Thanks in advance!
SELECT A.data1, A.data2
WHERE A.id IN (SELECT B.id_U
WHERE B.nr IN (SELECT ...));
What stops you from using JOINS? If you're database is normalized properly using joins is faster than subquery. In that scenario you'll have
SELECT A.data1, A.data2, B.nr
FROM table_A as A
JOIN table_B as B ON A.id_U = A.id
WHERE B.nr (SET YOUR FILTERS HERE OR JOIN AGAIN TO THE OTHER TABLES W/CE SUITS YOUR REQUIREMENTS)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)