Reputation: 405
Now, I'm more of a Dev than a DBA, but this doesn't seem to be very logical, so putting aside whether or not there is a better way of doing this, I'm struggling to find the logic in this.
select distinct testid from tbl_result
A seeming simple piece of sql, right, the trouble is that when I run it (both in code and query analyser) I get different result sets each time. what is interesting is that the result sets return the same number of records, and they are unique against the other (no value shows up in both datasets) but after a random number of F5 pushes we get different results, there isn't even any consistent number of times that each different set shows.
Table structure:
As I said to start, I know I can get the list of 1000 or so testIds a different way, but I'm really curious if anyone has come across this kind of scenario before.
Thanks in advance.
Upvotes: 0
Views: 1186
Reputation: 26
Is it possibly returning the same testid values, just in a different order? Can you give more information about the table structure? Is there a clustered index and/or primary key on the table? Why specifically are you selecting DISTINCT instead of just selecting the testids? Have you taken a look at the execution plan?
Upvotes: 1