General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
I’m trying to SELECT DISTINCT on two fields on a huge view. (as shown in subquery)
When I run a DISTINCT by itself in those two fields it may take some 10 min to run but when I try this SELECT below it takes forever. Even worst, I am not sure it will bring what I want. What I need is to bring ALL the fields on my DISTINCT. Am I doing this right?
SELECT *
FROM view1
WHERE Acc_field IN
(SELECT DISTINCT Acc_field FROM view1 WHERE year = '2001'
AND Acc_field LIKE '5%')
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only