Hallo zusammen,
ich habe folgendes Problem. Wenn ich mein Java Programm ausführe erscheint immer ein Fehler in der eingebetten SQL Abfragen.
private static List<Object[]> getWordAnalyse(String word){
return DatabaseAccess
.getSqlStatementResult(
"SELECT coocTable.corpusDate, coocTable.word, aFreq AS H?ñufigkeitY, aCooc AS SatzcoocY, bfreq as H?ñufigkeitX, value" +
"FROM(" +
"SELECT word, DATE(createDate) AS corpusDate, cooc AS aCooc" +
"FROM ("+
"SELECT createDate, word, count(DISTINCT sentence.id) AS cooc" +
"FROM" +
" corpus " +
"INNER JOIN " +
" article ON corpus.id = article.corpusId " +
"INNER JOIN " +
" sentence ON article.id = sentence.articleId " +
"INNER JOIN " +
" term ON sentence.id = term.sentenceId " +
"WHERE " +
" sentence.id IN ( " +
"SELECT sentence.id" +
"FROM " +
" corpus " +
"INNER JOIN " +
" article ON corpus.id = article.corpusId " +
"INNER JOIN " +
" sentence ON article.id = sentence.articleId " +
"INNER JOIN " +
" term ON sentence.id = term.sentenceId" +
"WHERE corpus.id = " + currentCorpus.getId() +
" 'AND " +
"word = '" + word + "' " +
") " +
"GROUP BY createDate, word" +
") AS tempTable1 " +
"GROUP BY corpusDate, word " +
") " +
"AS coocTable " +
"INNER JOIN ( " +
"SELECT word, corpusDate, freq AS bFreq " +
"FROM ( " +
"SELECT word, DATE(createDate) AS corpusDate, " +
" count(DISTINCT sentence.id) AS freq" +
"FROM " +
" corpus " +
"INNER JOIN " +
" article ON corpus.id = article.corpusId " +
"INNER JOIN " +
" sentence ON article.id = sentence.articleId " +
"INNER JOIN " +
" term ON sentence.id = term.sentenceId " +
"where corpus.id = " + currentCorpus.getId() +
"'AND " +
"word ='" + word + "' " +
"GROUP BY createDate, word) AS tempTable " +
"GROUP BY corpusDate, word)" +
"AS freqTables " +
"INNER JOIN ( " +
"SELECT word, corpusDate, freq AS aFreq " +
"FROM ( " +
"SELECT word, DATE(createDate) AS corpusDate, " +
"count(DISTINCT sentence.id) AS freq" +
"FROM " +
" corpus " +
"INNER JOIN " +
" article ON corpus.id = article.corpusId " +
"INNER JOIN " +
" sentence ON article.id = sentence.articleId " +
"INNER JOIN " +
" term ON sentence.id = term.sentenceId "+
"GROUP BY createDate, word) AS tempTable2 " +
"GROUP BY corpusDate, word)" +
"AS freqTable ON coocTable.corpusDate = freqTable.corpusDate " +
"INNER JOIN sentiws on coocTable.word = sentiws.word" +
"WHERE coocTable.word = freqTable.word " +
"ORDER BY coocTable.word, coocTable.corpusDate;"
);
Die SQL Abfrage funktioniert aber einwandfrei.
[SQL]
SELECT coocTable.corpusDate, coocTable.word, aFreq AS H?§ufigkeitY, aCooc AS SatzcoocY, bfreq as H?§ufigkeitX, value
FROM(
SELECT word, DATE(createDate) AS corpusDate, cooc AS aCooc
FROM (
SELECT createDate, word, count(DISTINCT sentence.id) AS cooc
FROM
corpus
INNER JOIN
article ON corpus.id = article.corpusId
INNER JOIN
sentence ON article.id = sentence.articleId
INNER JOIN
term ON sentence.id = term.sentenceId
WHERE
sentence.id IN (
SELECT sentence.id
FROM
corpus
INNER JOIN
article ON corpus.id = article.corpusId
INNER JOIN
sentence ON article.id = sentence.articleId
INNER JOIN
term ON sentence.id = term.sentenceId
WHERE corpus.id = 1 AND word = ‘Schalke’
)
GROUP BY createDate, word
) AS tempTable1
GROUP BY corpusDate, word
)
AS coocTable
INNER JOIN (
SELECT word, corpusDate, freq AS bFreq
FROM (
SELECT word, DATE(createDate) AS corpusDate,
count(DISTINCT sentence.id) AS freq
FROM
corpus
INNER JOIN
article ON corpus.id = article.corpusId
INNER JOIN
sentence ON article.id = sentence.articleId
INNER JOIN
term ON sentence.id = term.sentenceId
where corpus.id = 1 AND word =‘Schalke’
GROUP BY createDate, word) AS tempTable
GROUP BY corpusDate, word
)
AS freqTables
INNER JOIN (
SELECT word, corpusDate, freq AS aFreq
FROM (
SELECT word, DATE(createDate) AS corpusDate,
count(DISTINCT sentence.id) AS freq
FROM
corpus
INNER JOIN
article ON corpus.id = article.corpusId
INNER JOIN
sentence ON article.id = sentence.articleId
INNER JOIN
term ON sentence.id = term.sentenceId
GROUP BY createDate, word) AS tempTable2
GROUP BY corpusDate, word
)
AS freqTable ON coocTable.corpusDate = freqTable.corpusDate
INNER JOIN sentiws on coocTable.word = sentiws.word
WHERE coocTable.word = freqTable.word
ORDER BY coocTable.word, coocTable.corpusDate
[/SQL]
Könnt ihr erkennen was ich im oberen Teil falsche gemacht habe?
Vielen dank