andrisp Posted May 22, 2006 Report Share Posted May 22, 2006 Ir firebird datubāze <1.0, kurai nav atbalsta SQL LIMIT keywordam. Varbūt varat palīdzēt uzrakstīt procedūru, kas dara to pašu ? Tādu, kurai var padot mainīgo no kura ieraksta sākt atlasīt ierakstus, un cik ierakstus atlasīt. Tipa piem., LIMIT 10,30. Paldies jau iepriekš. Link to comment Share on other sites More sharing options...
Kristabs Posted May 22, 2006 Report Share Posted May 22, 2006 Man liekas, ka ar SQL citu variantu nav. Vari ar PHP skaitiit un endot ciklu. Link to comment Share on other sites More sharing options...
andrisp Posted May 22, 2006 Author Report Share Posted May 22, 2006 Varētu jau ar php, bet to pašu, cik zinu, var izdarīt arī firebird pusē ar storētās procedūras palīdzību, kas būtu daudz labāk. Link to comment Share on other sites More sharing options...
Delfins Posted May 22, 2006 Report Share Posted May 22, 2006 slavenais oracle pieprasījums, domājams strādās arī FB... select * from (select recid, * from Table ) where recid between ... PS: papilns gūglē šitais... `Oracle LIMIT` Link to comment Share on other sites More sharing options...
andrisp Posted May 22, 2006 Author Report Share Posted May 22, 2006 (edited) kas ir recid ? Edited May 22, 2006 by andrisp Link to comment Share on other sites More sharing options...
litt Posted May 22, 2006 Report Share Posted May 22, 2006 Teorētiski jāstrādā šādi: select * from (select ROWNUM rnum, t.* from tabula t) where rnum between 1 and 3; Link to comment Share on other sites More sharing options...
andrisp Posted May 22, 2006 Author Report Share Posted May 22, 2006 firebird'ā nestrādā Link to comment Share on other sites More sharing options...
Delfins Posted May 22, 2006 Report Share Posted May 22, 2006 lasi RTFM lai dabūtu ko līdzīgu Link to comment Share on other sites More sharing options...
darksign Posted March 12, 2008 Report Share Posted March 12, 2008 Lai dabūtu firebirdā limitu tad sintakse tāda SELECT FIRST x [SKIP y] … [rest of query] Piemēram, ja ar mysql tu taisītu šādi: SELECT column1, column2, column3 FROM foo LIMIT 10, 20 vai ar PostgreSQL (pretēji mysql): SELECT column1, column2, column3 FROM foo LIMIT 20, 10 tad to pašu sql iekš firebird var uzrakstīt lūk tā: SELECT FIRST 10 SKIP 20 column1, column2, column3 FROM foo p.s. pats meklēju un atradu to šeit: links gan jau kādam noderēs vēlāk ;) Link to comment Share on other sites More sharing options...
marrtins Posted March 12, 2008 Report Share Posted March 12, 2008 Yup, uz jaunajiem Firebird (liekas, ka uz ), kā jau darksing pieminēja: SELECT FIRST x [SKIP y] … [rest of query] Vai arī SELECT ... [ORDER BY <expr_list>] ROWS <expr1> [TO <expr2>] Uz firebird < 1.0 var mēģināt (čerezŽ) laist caur procedūru: CREATE PROCEDURE TABLE_LIMITER (start INTEGER, num INTEGER) RETURNS (id INTEGER, data_field1 VARCHAR(255), data_field2 VARCHAR(255), <utt.>, ...) AS DECLARE VARIABLE c INTEGER; BEGIN c = 0; FOR SELECT id, data_field1, data_field2, <utt.>, ... FROM some_table ORDER BY some_field INTO :id, :data_field1, :data_field2, :<utt.>, ... DO BEGIN IF (c = :start + :num) THEN EXIT; ELSE IF (c >= :start) THEN SUSPEND; c = c + 1; END END Totāls čerezžē :)) Protams, silti iesaku apgreidoties uz jaunāko (2.1RC2) - daudz stabilāks, visādas jaunas mantiņas un bumbulīši un arī ĀTRĀKS :) Link to comment Share on other sites More sharing options...
bubu Posted March 12, 2008 Report Share Posted March 12, 2008 Kas te par kapraču saietu? Link to comment Share on other sites More sharing options...
marrtins Posted March 12, 2008 Report Share Posted March 12, 2008 khe, nepiefixēju datumu :D Link to comment Share on other sites More sharing options...
darksign Posted March 13, 2008 Report Share Posted March 13, 2008 tas tikai lai pasham kad savajagas nevajag otreiz mekleet pa aarzemeem, ja tepat forumaa var savu postu iechekot kad taa lieta piemirstas ;) p.s. ar rows arī labs paņēmiens, tnx martins ;) Link to comment Share on other sites More sharing options...
darksign Posted March 13, 2008 Report Share Posted March 13, 2008 hmm, manaa interbase versijaa tomeer tas "...ROWS x TO y" nedarbojas, laikam paaraak veca :( Link to comment Share on other sites More sharing options...
Recommended Posts