Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 6 of 6 total |
HAVING WITH IN(xx,xx,xx,xx,xx,xx,xx,xx) |
Mon, Mar 17 2008 3:04 PM | Permanent Link |
Roger Oliveira from (Brazil) | Hi, I need to do one SQL with: Ex: SELECT AREA_ID,SUM(SECONDS) TOTAL FROM TAG_DEBUGGED GROUP BY AREA_ID,REASON HAVING AREA_ID IN(1,2,3) Why this is not work in DBISAM? Just like : AREA_ID = 1 OR AREA_ID = 2 OR AREA_ID = 3 This is one problem for me! Roger. |
Mon, Mar 17 2008 3:16 PM | Permanent Link |
"Jeff Cook" | Roger Oliveira from (Brazil) wrote:
> > Hi, I need to do one SQL with: > > Ex: SELECT AREA_ID,SUM(SECONDS) TOTAL > FROM TAG_DEBUGGED > GROUP BY AREA_ID,REASON HAVING AREA_ID IN(1,2,3) > > > Why this is not work in DBISAM? Just like : AREA_ID = 1 OR AREA_ID > = 2 OR AREA_ID = 3 > > This is one problem for me! > > Roger. Call me dumb .... thank you ... but I can't see why you are using a HAVING here when a WHERE would do and I suspect would be faster too. ? is there a problem with a column in the GROUP BY that isn't selected ? Cheers Jeff -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz + Joan and Jeff Cook The Cooks Oasis www.cookislandsoasis.com |
Mon, Mar 17 2008 5:06 PM | Permanent Link |
"Robert" | "Roger Oliveira from (Brazil)" <roger@puxtreme.com.br> wrote in message news:3F269C56-0361-4BE4-9DD9-3B7581695628@news.elevatesoft.com... > > Hi, I need to do one SQL with: > > Ex: SELECT AREA_ID,SUM(SECONDS) TOTAL > FROM TAG_DEBUGGED > GROUP BY AREA_ID,REASON HAVING AREA_ID IN(1,2,3) > 1. You should select REASON 2. HAVING is for a test after aggregating. Use WHERE Robert > > Why this is not work in DBISAM? Just like : AREA_ID = 1 OR AREA_ID = 2 OR > AREA_ID = 3 > > This is one problem for me! > > Roger. > |
Tue, Mar 18 2008 6:09 AM | Permanent Link |
"Jose Eduardo Helminsky" | Roger
> Ex: SELECT AREA_ID,SUM(SECONDS) TOTAL > FROM TAG_DEBUGGED > GROUP BY AREA_ID,REASON HAVING AREA_ID IN(1,2,3) Change the clause HAVING to WHERE. You can only use HAVING to compare fields after group by BTW Where are you from ? I live in Piracicaba, 170Km from Sao Paulo Regards. Eduardo |
Wed, Mar 19 2008 3:55 PM | Permanent Link |
"GP" | Try the following:
SELECT AREA_ID, REASON, SUM(SECONDS) AS TOTAL FROM TAG_DEBUGGED GROUP BY AREA_ID,REASON HAVING AREA_ID IN (1,2,3) "Jose Eduardo Helminsky" <contato@hpro.com.br> wrote in message news:2A109977-22F3-49D2-94B1-4FC8C925EED3@news.elevatesoft.com... > Roger > >> Ex: SELECT AREA_ID,SUM(SECONDS) TOTAL >> FROM TAG_DEBUGGED >> GROUP BY AREA_ID,REASON HAVING AREA_ID IN(1,2,3) > > Change the clause HAVING to WHERE. > You can only use HAVING to compare fields after group by > > BTW > Where are you from ? I live in Piracicaba, 170Km from Sao Paulo > > Regards. > > Eduardo > |
Wed, Mar 19 2008 4:08 PM | Permanent Link |
"GP" | Correction:
Try SELECT AREA_ID, REASON, SUM(SECONDS) AS TOTAL FROM TAG_DEBUGGED WHERE AREA_ID IN (1,2,3) GROUP BY AREA_ID,REASON should execute faster "GP" <gp@usa.com> wrote in message news:DC679244-D36B-4024-A8EF-CDC32F2DCF41@news.elevatesoft.com... > Try the following: > > SELECT AREA_ID, REASON, SUM(SECONDS) AS TOTAL > FROM TAG_DEBUGGED > GROUP BY AREA_ID,REASON HAVING AREA_ID IN (1,2,3) > > "Jose Eduardo Helminsky" <contato@hpro.com.br> wrote in message > news:2A109977-22F3-49D2-94B1-4FC8C925EED3@news.elevatesoft.com... >> Roger >> >>> Ex: SELECT AREA_ID,SUM(SECONDS) TOTAL >>> FROM TAG_DEBUGGED >>> GROUP BY AREA_ID,REASON HAVING AREA_ID IN(1,2,3) >> >> Change the clause HAVING to WHERE. >> You can only use HAVING to compare fields after group by >> >> BTW >> Where are you from ? I live in Piracicaba, 170Km from Sao Paulo >> >> Regards. >> >> Eduardo >> > > |
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 |