Search Result

Collapse
3 results in 0.0014 seconds.
Keywords
Members
Tags
order by
  •  

  • angelopc
    started a topic MySQL, ORDER BY Multiple, 2nd ARG is ignored.
    in PHP

    MySQL, ORDER BY Multiple, 2nd ARG is ignored.

    I'm trying to retrieve some results from a table. I want the results chosen randomly, then sorted by the number of "hits".

    Here's the code I'm using:
    Code:
    <?php $latestQuery = "SELECT * FROM pages ORDER BY RAND(), hits DESC LIMIT 100"; ?>
    With this syntax, the results are chosen randomly, but they are not sorted by "hits".

    You can see the results at Insoogle.com (scroll...
    See more | Go to post

  • recordscout
    started a topic DISTINCT and ORDER BY

    DISTINCT and ORDER BY

    Hi,

    I have a table with product names and separate prices.
    I want to show the distinct product names in alphabetical order, but at the same time show the cheapest price first.

    I can of course use GROUP BY for the product names, but when I apply the order by PRODUCTNAME to the GROUP BY it will list the first product in the database and not the cheapest product. I can not use INNER JOIN as it is from one table....
    See more | Go to post

  • ylekot88
    started a topic group by works, order by gives error msg

    group by works, order by gives error msg

    Hi

    I am a student, I am trying to figure this out. I am trying to run a select statement that is asking for customer#, date, and total price of each order. ensure results are in chronological order based upon order date.

    When I run the following with just a group by clause, it works. If I add order by orderdate, I get an error message that states SQL Error: ORA-00979: not a GROUP BY expression. Why is the order by...
    See more | Go to post
Working...