Einzelnen Beitrag anzeigen

DaWi

Registriert seit: 22. Nov 2003
9 Beiträge
 
#3

Re: Warum geht diese SQL Anweisung nicht?

  Alt 12. Dez 2003, 06:36
Ich bin mir jetzt nicht ganz sicher, aber laß bei den rot markierten Teilen mal die Hochkommata weg... das sind ja Namen und keine Feldinhalte... zudem benötigst / benutzt Du diese Namen ja gar nicht oder ???

SQL-Code:
DROP TEMPORARY TABLE IF EXISTS temp_table1;
CREATE TEMPORARY TABLE temp_table1 (info text, anzahl_allg text, anzahl_inst text);
INSERT INTO temp_table1 (info, anzahl_allg) SELECT year(abgabedatum), count(*) from gutachten where freigegeben = 1 group by year(abgabedatum); DROP TEMPORARY TABLE IF EXISTS temp_table2;
CREATE TEMPORARY TABLE temp_table2 (info text, anzahl_inst text);
INSERT INTO temp_table2 (info, anzahl_inst) SELECT year(abgabedatum)[color=red] AS 'Info'[/color], count(*) [color=red]AS 'Anzahl' [/color]from gutachten where inr = 11 and freigegeben = 1 group by year(abgabedatum);
UPDATE temp_table1, temp_table2 set temp_table1.anzahl_inst = temp_table2.anzahl_inst where temp_table1.info = temp_table2.info;
Gruß

DaWi

[edit=r_kerber]SQL-Tags gesetzt! Mfg, r_kerber[/edit]
  Mit Zitat antworten Zitat