Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 6 of 6 total |
SELECT MAX - HOW? |
Fri, Apr 28 2006 1:44 PM | Permanent Link |
"TorB." | Hi experts
I have this very simple query: SELECT MAX(Nr) INTO NFAKT FROM FAKTURA It works OK, but if the FAKTURA table is empty a NULL value is put into the NFAKT table. How can I change the SQL and put 0 (The number Zero) into NFAKT if the FAKTURA table is empty? I have tried with a varity of IF-statements of which none have worked. Kind regards TorB. |
Fri, Apr 28 2006 2:02 PM | Permanent Link |
"Jose Eduardo Helminsky" | TorB
Try using this (not tested) select if(max(nr)=null,0,max(nr)) from faktura Eduardo |
Fri, Apr 28 2006 2:18 PM | Permanent Link |
"TorB." | Hi Eduardo!
My God I got an answer in 16 mins, I am impressed. Your solution worked like this: SELECT IF(MAX(NR)=NULL,0,MAX(NR)) INTO NFAKT FROM FAKTURA Thank you very much for your kind help. Best regards TorB. *** "Jose Eduardo Helminsky" <contato@hpro.com.br> skrev i melding news:38B95F31-D0A1-4EB5-AF81-F3B681AC838D@news.elevatesoft.com... > TorB > > Try using this (not tested) > select if(max(nr)=null,0,max(nr)) from faktura > > Eduardo > |
Fri, Apr 28 2006 2:54 PM | Permanent Link |
"Jose Eduardo Helminsky" | TorB
You are welcome. Eduardo |
Fri, Apr 28 2006 3:38 PM | Permanent Link |
"Clive" | OR.. If you wanted another way!.. Every so slightly shorter, but same
result. SELECT Coalesce(MAX(NR),0) INTO NFAKT FROM FAKTURA "TorB." <newspost@datarommet.no> wrote in message news:225E9356-AA5B-4592-A1A2-B4DDF84ADFA0@news.elevatesoft.com... > Hi Eduardo! > > My God > I got an answer in 16 mins, I am impressed. > > Your solution worked like this: > SELECT > IF(MAX(NR)=NULL,0,MAX(NR)) > INTO NFAKT > FROM FAKTURA > > Thank you very much for your kind help. > > Best regards > TorB. > > *** > "Jose Eduardo Helminsky" <contato@hpro.com.br> skrev i melding > news:38B95F31-D0A1-4EB5-AF81-F3B681AC838D@news.elevatesoft.com... >> TorB >> >> Try using this (not tested) >> select if(max(nr)=null,0,max(nr)) from faktura >> >> Eduardo >> > > |
Fri, Apr 28 2006 8:08 PM | Permanent Link |
"TorB." | Thank you, Clive!
I'll check it up. Best regards TorB. **** "Clive" <dd@dddd.com> skrev i melding news:4276C24E-4D0D-4E77-9649-38CDFEC6981D@news.elevatesoft.com... > OR.. If you wanted another way!.. Every so slightly shorter, but same > result. > > SELECT > Coalesce(MAX(NR),0) > INTO NFAKT > FROM FAKTURA > > > > "TorB." <newspost@datarommet.no> wrote in message > news:225E9356-AA5B-4592-A1A2-B4DDF84ADFA0@news.elevatesoft.com... >> Hi Eduardo! >> >> My God >> I got an answer in 16 mins, I am impressed. >> >> Your solution worked like this: >> SELECT >> IF(MAX(NR)=NULL,0,MAX(NR)) >> INTO NFAKT >> FROM FAKTURA >> >> Thank you very much for your kind help. >> >> Best regards >> TorB. >> >> *** >> "Jose Eduardo Helminsky" <contato@hpro.com.br> skrev i melding >> news:38B95F31-D0A1-4EB5-AF81-F3B681AC838D@news.elevatesoft.com... >>> TorB >>> >>> Try using this (not tested) >>> select if(max(nr)=null,0,max(nr)) from faktura >>> >>> Eduardo >>> >> >> > > |
This web page was last updated on Monday, May 6, 2024 at 12:52 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |