Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
The result of my query doesn't respect the primary index |
Mon, May 23 2011 10:46 AM | Permanent Link |
Josselin | Hi,
I use two tables "E001001" and "E001002" which have the same structure, the same index and that contain the same records (only certain values change). I run the same query on both tables and I get different results This is the first query : SELECT Code, P1 FROM E001001 WHERE (Unite IS NOT NULL) AND (Ref <> 'K') This is the result of the first query, result is good Code P1 1.1.1.1. 5 1.1.2.1. 2 1.1.3.1. 6 1.1.4.1. 350 1.1.5.1. 30 1.1.6.1 30 1.1.7.1. 12 1.1.7.2. 12 1.1.7.3. 100 1.1.7.4. 50 1.1.7.5. 50 1.1.7.6. 10 1.1.8.1. 12 1.1.8.2. 12 1.1.8.3. 100 1.1.8.4. 50 And this is the second query : SELECT Code, P1 FROM E001002 WHERE (Unite IS NOT NULL) AND (Ref <> 'K') This is the result of the second query, result is not good because the order of the index is not respected. Code P1 1.1.8.4. 35 1.1.8.3. 100 1.1.8.2. 12 1.1.8.1. 15 1.1.7.6. 10 1.1.7.5. 60 1.1.7.4. 35 1.1.7.3. 100 1.1.7.2. 12 1.1.7.1. 15 1.1.6.1 20 1.1.5.1. 35 1.1.4.1. 300 1.1.3.1. 5.5 1.1.2.1. 2.2 1.1.1.1. 4.1 If I add in the query the field that serves as a primary index, the result of my query is correct. Is it obligatory to have the primary index in the request or using the clause "ORDER BY" for data to be displayed in the right order? Thanks for your help Greetings Bruno Riviere AJ SOFT |
Mon, May 23 2011 11:32 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Josselin
ElevateDB will, unless an ORDER BY is specified simply return the results as it finds them. The best approach, if you're bothered about the order, is always use an ORDER BY. Roy Lambert [Team Elevate] |
Tue, May 24 2011 3:16 AM | Permanent Link |
Josselin | Ok, that's what I thought
thanks a lot Roy Lambert wrote: Josselin ElevateDB will, unless an ORDER BY is specified simply return the results as it finds them. The best approach, if you're bothered about the order, is always use an ORDER BY. Roy Lambert [Team Elevate] |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |