Results 1 to 5 of 5

Thread: Ryan

  1. #1
    Most Popular Field Values Guest

    Default Ryan

    I&#039ve read that you can use the following type of query statement to get the most popular values using SQL for say a survey where people put in the size of their company into the field called "size"<BR><BR>query=" Select TOP 3 size, Number=count(*), from survey GROUP BY size ORDER BY Number desc"<BR><BR>I tried this using an Access db and get error messages (the old "Too few parameters. Expected 1" message). Am I coding this wrong or do I need to do this differently for Access?<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Tryin' real hard huh...<eop>


  3. #3
    dope Guest

    Default Why are you being a tool? <eop>


  4. #4
    Join Date
    Dec 1969

    Default Tool n.

    1)A device, such as a saw, used to perform or facilitate manual or mechanical work. <BR><BR>2)A machine, such as a lathe, used to cut and shape machine parts or other objects. <BR>-The cutting part of such a machine. <BR><BR>3)Something regarded as necessary to the carrying out of one&#039s occupation or profession: Words are the tools of our trade. <BR><BR>4)Something used in the performance of an operation; an instrument: “Modern democracies have the fiscal and monetary tools . . . to end chronic slumps and galloping inflations” (Paul A. Samuelson). <BR><BR>5)Vulgar. Slang A penis. <BR><BR>6)A person used to carry out the designs of another; a dupe. <BR><BR>7)A bookbinder&#039s hand stamp. <BR>A design impressed on a book cover by such a stamp. <BR><BR>8)Computer Science. An application program in some computer systems. <BR><BR>(From dictionary.com)<BR>---<BR><BR><BR>I don&#039t get your point.

  5. #5
    Join Date
    Dec 1969

    Default RE: Ryan

    Select TOP 3 size, Number=count(*), from survey GROUP BY size ORDER BY Number desc" <BR><BR><BR>In the above example I presume the folowing are field names?<BR>Viz : size, number<BR><BR>If so I suggest you CHANGE the names. I think one or both may be reserved words.<BR><BR><BR>SELECT Subjects.BookId, Count(Subjects.SubjectId) AS Countz, Subjects.BookId<BR>FROM Subjects<BR>GROUP BY Subjects.BookId<BR>ORDER BY Count(Subjects.SubjectId), Subjects.BookId;<BR><BR>Above SQL should do what you want, just change the names to protect the innocent<BR><BR>R<BR>

Posting Permissions

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