Article View: borland.public.interbase.sql
Article #973Re: Select from variable
From: aleplgr
Date: Tue, 03 Apr 2007 08:55
Date: Tue, 03 Apr 2007 08:55
43 lines
2319 bytes
2319 bytes
"Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca> wrote: >aleplgr wrote: >> >> first I select the max and min CLIENTIDs and store them in the >> MAXCLIENTID and MINCLIENTID variables this works fine, although I'm >> not sure this is the way to do it: >> >> SELECT MAX(CLIENTID) FROM TEMPORALPRUEBA1 INTO :MAXCLIENTID; >> SELECT MIN(CLIENTID) FROM TEMPORALPRUEBA1 INTO :MINCLIENTID; > >This is fine, but you could combine this into a single statement: > > SELECT MIN(CLIENTID), MAX(CLIENTID) > FROM TEMPORALPRUEBA1 > INTO :MINCLIENTID, :MAXCLIENTID; > >> SELECT MAX(GENE) FROM TEMPORALPRUEBA1 WHERE >> CLIENTID = MINCLIENTID INTO :IDMAX; >> >> and I'm getting the error >> Column unknown MINCLIENTID. > >Because it thinks you are naming a column instead of a variable. In any SQL >statement you must include the colon ot indicate local variables: > > ... WHERE CLIENTID = :MINCLIENTID INTO :IDMAX; > >> I'm writing the procedure in EMS SQL MANAGER 2005 for InterBase/ >> firebird and I'm getting the error when I compile the procedure > >This will work for Firebird, but these are InterBase groups. They are >different products that are differing more with each release. You really >should ask Firebird questions in Firebird newsgroups for the best answers on >that product. > >-- >Wayne Niddery - Winwright, Inc (www.winwright.ca) >SpaceShipOne; GovernmentZero > > Thanks! Great!!!
Technical Details
Message-ID:
<4612088d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46112987$1@newsgroups.borland.com> <46114349$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,9d569d1fdba243ad X-Google-Attributes: gid114a0e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "aleplgr" <aleplgr@yahoo.es> Sender: "aleplgr" <aleplgr@yahoo.es> Reply-To: "aleplgr" <aleplgr@yahoo.es> Subject: Re: Select from variable Newsgroups: borland.public.interbase.sql X-User-Info: 80.58.205.38 X-Forwarded-For: 80.25.195.180, 192.168.1.55 References: <46112987$1@newsgroups.borland.com> <46114349$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <4612088d$1@newsgroups.borland.com> Date: 3 Apr 2007 00:55:57 -0800 X-Trace: newsgroups.borland.com 1175586957 207.105.83.66 (3 Apr 2007 00:55:57 -0800) Lines: 44 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail