Hi,
i have got a problem with my SQL Statement:
Table structure:
CREATE TABLE "tags" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"page_id" INTEGER NOT NULL,
"title" TEXT NOT NULL
);
Now i want to select all the tags from one page and the frequency of this tag in the whole database. I have the following SQL statement:
SELECT title, title as t,
(SELECT COUNT(*) FROM tags WHERE title=t) as count
FROM tags WHERE page_id=42 ORDER BY count DESC, title
COLLATE NOCASE ASC;
But the error message i'm getting from SQLite3 Driver in PHP:
no such column: t
How do i have to write the SQL statement so that i get the result i want to have?
Thanks, Levu