Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004

    Question Unanswered: cross platform derived table query/subquery in from clause

    It's like this, I have a table of searchstrings that I want to list based on unique searchstrings and unique users(because some users search for the exact same thing many times)

    table tbl_savesearch
    id, searchStr, remote_addr, was_answered

    This is the query that works on MS SQL server, but I can't get to work in MySQL:

    SELECT ss, COUNT(DISTINCT ra) AS theCount
    FROM (SELECT DISTINCT searchStr AS ss, remote_addr AS ra FROM tbl_savesearch) tb
    GROUP BY ss
    ORDER BY theCount DESC

    I checked the mysql documentation and it seems mysql needs to put in an "as" before "tb", but it still won't work.

    Is there a standard for this question, some way that I can make it work on both platforms?

    Edit: is this thing really called derived table or is it just a subquery? English is not my native language.
    Last edited by daytripper; 01-22-04 at 13:11.

  2. #2
    Join Date
    Sep 2002
    Provided Answers: 1

    Re: cross platform derived table query/subquery in from clause

    A subquery in the FROM clause is usually called an "inline view" (or at least, it is in Oracle circles). Whether mySQL supports inline views at all, I don't know.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts