Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 4 of 4 total |
Problem in SQL, need help |
Tue, Jan 29 2008 10:49 AM | Permanent Link |
Eduardo Pereira | I need to UNION the results of three querys. Each query returns the top 50 records os each type.
SELECT ID, MODELO, VIN, DATAHORA FROM TBMEASUREMENTS WHERE MODELO = 'Celta 3P' TOP 50 UNION SELECT ID, MODELO, VIN, DATAHORA FROM TBMEASUREMENTS WHERE MODELO = 'Celta 5P' TOP 50 UNION SELECT ID, MODELO, VIN, DATAHORA FROM TBMEASUREMENTS WHERE MODELO = 'Prisma' TOP 50 The problem: The result is only 50 records of MODELO = 'Celta 3P' Help!!! Attachments: Database.rar |
Tue, Jan 29 2008 11:17 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Eduardo
Try creating a script, squirting each of the individual queries into a memory table and then UNION those. Remember to drop the memory tables when you've finished with them Roy Lambert |
Tue, Jan 29 2008 1:48 PM | Permanent Link |
"Malcolm" | Eduardo
Did you try increasing the TOP value for each union? .... TOP 50 .... TOP 100 .... Top 150 |
Tue, Jan 29 2008 3:51 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Eduardo,
<< I need to UNION the results of three querys. Each query returns the top 50 records os each type. >> You can only use TOP with the first query in a series of UNION, etc. statements. TOP is a "final" operation on the entire statement, so it is only going to grab the first 50 rows of the final result set. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |