Here's your original request based on the column and table names you gave us:
select id, url, images, Total from ( select * from temp order by id desc limit 10 ) last10 order by Total desc;
As for my pseudo-code you're confused about, that's only relevant if you have two tables that you might want to cross reference. As a more realistic example, suppose you have a database with Customers and Orders, and you want to find out your top ten buyers. You could do that like this:
select Customers.name, sales.amount -- select na +me and total amount spent. from Customers, ( -- a sub-sel +ect to find the 10 best buyers. select customer_id, sum(order_amount) as amount -- This sele +cts a column and an aggregate from Orders -- from the +real table Orders. group by customer_id order by amount desc limit 10 ) sales -- we name t +his sub-select "sales". where sales.customer_id = Customers.id -- we INNER +JOIN the two "tables", -- so we can + cross-reference Orders against Customers.

As you can see, the "sales" sub-select isn't a real table in the database, but within this query we can treat it as if it were. We can select columns from it, and put extra constraints on it in a where clause. I hope it's a bit clearer now :)


In reply to Re^5: (OT) MySQL query to limit and sort by rhesa
in thread (OT) MySQL query to limit and sort by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.