qce Posted August 9, 2004 Report Share Posted August 9, 2004 Varbuut shis te jautaajiens te nav i pa teemai, bet ceru ka kaac spees palidzeet, nu vismaz a padomu! Man ir sekojosha probleema ar MS Access, SQL kods ir shaads: SELECT Darijums.Prec_KN_kods, Round(Sum(Darijums!Cena)*0.662,0) AS Summa, Round(Sum(Darijums!Masa),0) AS Masa, Sum(Darijums!Daudzums) AS Daudzums, Darijums.Nos_v_kods, Darijums.Izc_v_kods, Darijums.Dar_kods FROM Darijums WHERE (((Darijums.Oper_num)=3) AND ((Darijums.[ienak/Izej])=Yes)) GROUP BY Darijums.Prec_KN_kods, Darijums.Nos_v_kods, Darijums.Izc_v_kods, Darijums.Dar_kods ORDER BY Darijums.Prec_KN_kods; man vajadzeetu dabuut lai: Ja "Darijums.Prec_KN_kods" = 84733010 un 84733090 tad "Darijums.Daudzums" veertiibu neraada tb tukshu lauku, bet attieciigi ja tur ir citi kodi tad lai raada tnx Link to comment Share on other sites More sharing options...
bubu Posted August 9, 2004 Report Share Posted August 9, 2004 Pamēģini šitā (kautgan es Accessa SQL sintaksi nezinu): SELECT Prec_KN_kods, Round(Sum(Cena)*0.662,0) AS Summa, Round(Sum(Masa),0) AS Masa, IF(Prec_KN_kods="84733010 un 84733090"; ""; Sum(Daudzums)) AS Daudzums, Nos_v_kods, Izc_v_kods, Dar_kods FROM Darijums WHERE (Oper_num=3) AND ([Ienak/Izej]=Yes)) GROUP BY Prec_KN_kods, Nos_v_kods, Izc_v_kods, Dar_kods ORDER BY Prec_KN_kods; Link to comment Share on other sites More sharing options...
Gacha Posted August 9, 2004 Report Share Posted August 9, 2004 (edited) Nu vispār tu pilnīgi nepareizajā sadaļā šito iepostēji, bet lai nu būtu. Nu nezinu vai sapratu, bet var būt tā: $sql = mysql_query("SELECT Darijums.Prec_KN_kods, Round(Sum(Darijums!Cena)*0.662,0) AS Summa, Round(Sum(Darijums!Masa),0) AS Masa, Sum(Darijums!Daudzums) AS Daudzums, Darijums.Nos_v_kods, Darijums.Izc_v_kods, Darijums.Dar_kods FROM Darijums WHERE (((Darijums.Oper_num)=3) AND ((Darijums.[Ienak/Izej])=Yes)) GROUP BY Darijums.Prec_KN_kods, Darijums.Nos_v_kods, Darijums.Izc_v_kods, Darijums.Dar_kods ORDER BY Darijums.Prec_KN_kods;"); while($row = mysql_fetch_assoc($sql)){ if($row['Prec_KN_kods'] != 84733010 && $row['Prec_KN_kods'] != 84733090){ echo 'Dati, kam Prec_KN_kods nav = ar 84733010 un 84733090'; } } Labojums: He, bubu pasteidzās un viņa metode ir labāka, jo netiek izmantots PHP, bet gan tikai SQL. Es tik labi SQL nezinu, tapēc daru šādi :) Edited August 9, 2004 by Gacha Link to comment Share on other sites More sharing options...
qce Posted August 9, 2004 Author Report Share Posted August 9, 2004 Atvainojos veelreiz ka ieposteejos ne iisti tajaa vietaa kur tas buutu jaadara, bet ... izveeles nebija. btw neviens no jums abiem sniegtajiem paraugiem man negaaja jo kaa redz MS Access ar savu liiko SQL sintaksi man to nenjem pretii - syntax error in query expresion Link to comment Share on other sites More sharing options...
Gacha Posted August 9, 2004 Report Share Posted August 9, 2004 Nu es to tavu SQL nēsmu mainījis un skatījies un cik redzu, tad bubu ar neko īpaši, bet redzu, ka mēs abi aizmirsām noņemt ; SQL beigās! Noņem to un palaid vēl! Link to comment Share on other sites More sharing options...
qce Posted August 9, 2004 Author Report Share Posted August 9, 2004 bet tad ko tagad man vareetu noziimeet shis te: Undifined function 'IF' in expression Link to comment Share on other sites More sharing options...
qce Posted August 9, 2004 Author Report Share Posted August 9, 2004 tjip viens gudrs cilveeks man ieteica pielietot VB: iebaazt shi ieksh Detail_Print IF (Prec_KN_kods = 84733010) and (Prec_KN_kods = 84733090) then Me.Daudzums.Visible = false else Me.Daudzums.Visible = true end if bet kautkaa man nekas tur nenotiekaas Link to comment Share on other sites More sharing options...
bubu Posted August 9, 2004 Report Share Posted August 9, 2004 (edited) bet tad ko tagad man vareetu noziimeet shis te: Undifined function 'IF' in expression Ja jau tu programmē Accessā, tad der ieskatīties tam helpā. Pat es atradu, ka if vietā jāliet Iif: SELECT Prec_KN_kods, Round(Sum(Cena)*0.662,0) AS Summa, Round(Sum(Masa),0) AS Masa, IIf(Prec_KN_kods="84733010 un 84733090"; ""; Sum(Daudzums)) AS Daudzums, Nos_v_kods, Izc_v_kods, Dar_kods FROM Darijums WHERE (Oper_num=3) AND ([Ienak/Izej]=Yes)) GROUP BY Prec_KN_kods, Nos_v_kods, Izc_v_kods, Dar_kods ORDER BY Prec_KN_kods Palasi šo: http://www.microsoft.com/resources/documen...et/jetch04.mspx Edited August 9, 2004 by bubu Link to comment Share on other sites More sharing options...
qce Posted August 9, 2004 Author Report Share Posted August 9, 2004 (edited) taga man kods izskataas shaadi: SELECT Darijums.Prec_KN_kods, Round(Sum(Darijums!Cena)*0.662,0) AS Summa, Round(Sum(Darijums!Masa),0) AS Masa, IIf(Darijums!Prec_KN_kods='84733010'," ", Sum(Darijums!Daudzums)) AS Daudzums, Darijums.Nos_v_kods, Darijums.Izc_v_kods, Darijums.Dar_kods FROM Darijums WHERE (Darijums.Oper_num=3) AND ([ienak/Izej]=Yes) GROUP BY Darijums.Prec_KN_kods, Darijums.Nos_v_kods, Darijums.Izc_v_kods, Darijums.Dar_kods ORDER BY Darijums.Prec_KN_kods; bet taga izpildot sho pieprasiijumu vinjsh man bljauj ka: Taga ailee DAUDZUMS raada visos laukos #Error Edited August 9, 2004 by qce Link to comment Share on other sites More sharing options...
bubu Posted August 9, 2004 Report Share Posted August 9, 2004 Tev viss laikam priekšā būs jāpasaka. Šīs rindiņas vietā: Round(Sum(Masa),0) AS Masa, ieliec šādu: Round(Sum(Daudzums!Masa),0) AS Masa, VAI Round(Sum(Masa),0) AS SumMasa, Link to comment Share on other sites More sharing options...
qce Posted August 9, 2004 Author Report Share Posted August 9, 2004 (edited) to jau visu jau pac izfunktiereeju un izdariiju, tnx, but taga man DAUDZUMS ailee visur raada #Error :P tb tur jaaliek Darijums!Masa jo Darijums ir tabulas nosaukums :P Edited August 9, 2004 by qce Link to comment Share on other sites More sharing options...
bubu Posted August 9, 2004 Report Share Posted August 9, 2004 Droši vien tāpēc errors, ka Daudzums aile ir ar skaitlisku tipu, bet "" ir tekstuāls tips. Link to comment Share on other sites More sharing options...
qce Posted August 10, 2004 Author Report Share Posted August 10, 2004 tas gan tiesa bubu! bet ko lai shaadaa situaacijaa dara? :) Link to comment Share on other sites More sharing options...
bubu Posted August 10, 2004 Report Share Posted August 10, 2004 Vai nu rādi tukšumu kā 0, vai arī pārliec kolonnas tipu uz tekstuālu. Link to comment Share on other sites More sharing options...
Venom Posted August 10, 2004 Report Share Posted August 10, 2004 Ū, bļāviens. Es ar Accessu kādus mēn. 3 nodarbojos, kad univerā vajadzēja. Un centīšos arī turpmāk bez viņa apieties. Pietiek vien ar to, ka darba jāraksta MS/Open Office macrosus. Link to comment Share on other sites More sharing options...
Recommended Posts