---
title: "Konvertera pollen till MySQL"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/58767-konvertera-pollen-till-mysql"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "joup"
published: "2002-11-11T21:39:28.000Z"
updated: "2002-11-11T23:24:30.000Z"
replies: 8
views: 210
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/58767-konvertera-pollen-till-mysql"
---

# Konvertera pollen till MySQL

## #1 — joup, 2002-11-11T21:39Z

Hittade ett jättefint poll-script här på Webforum, i scriptarkivet. Tyvärr så var det kodat för Access, så jag håller på att försöka konvertera det till MySQL. Har dock stött på ett litet problem.

```
SQLResult = "Select Count(Result.ID) as Antal, Questions.Question, Questions.ID	From Result, Questions " & _
"Where Result.PollID = '" & RSMainQuestion("ID") & "' And Result.QuestionID = Questions.ID " & _
"Group By Questions.Question, Questions.ID " & _
"UNION " & _
"Select 0 as Antal, Questions.Question, Questions.ID From Questions " & _
"Where Questions.PollID = '" & RSMainQuestion("ID") & "' And Questions.ID Not In (Select QuestionID From Result Where PollID = '" & RSMainQuestion("ID") & "') " & _
"Group By Questions.Question, Questions.ID " & _
"Order By Questions.ID Asc"

RS.Open SQLResult, Connection, 3, 1
```

Ovanstående SQL-sats fungerar utmärkt med Access, men i MySQL så får jag felmeddelandet 

*Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
ODBC-drivrutinen stöder inte de begärda egenskaperna.
/Poll/Resultat2.asp, line 68*

Vad är det som inte MySQL klarar av?

Permalänk: https://www.webforum.nu/p/58767

## #2 — Ekström, 2002-11-11T21:44Z

Subselecten skulle jag tippa på.

Permalänk: https://www.webforum.nu/p/852508

## #3 — joup, 2002-11-11T21:47Z

Hmm, ja, det kan nog stämma. Har du något förslag hur man kan ersätta den med något som fungerar i MySQL?

Permalänk: https://www.webforum.nu/p/852512

## #4 — Ekström, 2002-11-11T21:53Z

Detta kanske kan funka:

```
SQLResult = "Select Count(Result.ID) as Antal, Questions.Question, Questions.ID	From Result, Questions " & _
"Where Result.PollID = '" & RSMainQuestion("ID") & "' And Result.QuestionID = Questions.ID " & _
"Group By Questions.Question, Questions.ID " & _
"UNION " & _
"Select 0 as Antal, Questions.Question, Questions.ID From Questions " & _
"Where Questions.PollID = '" & RSMainQuestion("ID") & "' And Questions.ID NOT = Result.QuestionID " & _
"Group By Questions.Question, Questions.ID " & _
"Order By Questions.ID Asc"

RS.Open SQLResult, Connection, 3, 1
```

Permalänk: https://www.webforum.nu/p/852522

## #5 — joup, 2002-11-11T21:59Z

Nix, samma fel.

Läste dock i MySQL-manualen att man endast kan köra UNION på MySQL-databaser som är av typen MERGE. Vad menas med det?

Permalänk: https://www.webforum.nu/p/852526

## #6 — LarsG, 2002-11-11T22:08Z

```
SQLResult = "Select Count(Result.ID) as Antal, Questions.Question, Questions.ID	"
" From Questions left outer join Result " & _
" on questions.id = result.questionid  " & _
" and  Result.PollID = '" & RSMainQuestion("ID") & "'" & _
" Group By Questions.Question, Questions.ID " & _
" Order By Questions.ID "
```

Permalänk: https://www.webforum.nu/p/852536

## #7 — joup, 2002-11-11T22:27Z

Får fortfarande samma fel

"ODBC-drivrutinen stöder inte de begärda egenskaperna."

Permalänk: https://www.webforum.nu/p/852558

## #8 — LarsG, 2002-11-11T22:34Z

Det har ingenting med sql-frågan att göra.

```
set RS = connection.execute(SQLResult)
```

MyODBC är inte så kapabel som man kan önska.

Permalänk: https://www.webforum.nu/p/852568

## #9 — joup, 2002-11-11T23:24Z

Nä, får det inte att fungera. Det är nåt som är fel, och jag är ingen mästare på SQL, så jag fattar inte.

Nåja, om någon skulle få för sig att konvetera pollen

<http://www.webforum.nu/showthread.php?s=&threadid=37470>

till MySQL så kan ni väl hojta till...

Permalänk: https://www.webforum.nu/p/852587

---

Tråden på webben: https://www.webforum.nu/amne/asp/58767-konvertera-pollen-till-mysql
