I need something like this: select all, but x should be distinct. I have price, title, link. I need to have all these but the title should be distinct. How can I do that?
blueparukia, thanks but that's a good answer for another question.. Geforce, how will that select unique titles and all the rest? Can you gimme an example?
Hi,For example if you wanted to bring out unique titles and say the minimum price for that title you could do: SELECT title, MIN(price), link FROM table GROUP BY title, link Code (markup): That will bring out all unique title and link with the minimum price available
Sorry, I may have misunderstood. I thought you wanted to select a unique row by title. Group by might work, but I'm not exactly clear on what you are asking.
What you want is (if it existed) SELECT (distinct title), link, price. The problem is that if you have 2 entries for a single title, with different links or different prices, the logic is "while true == false" - IOW, title is distinct but link (or price) isn't, so a single row can't satisfy your query. In this situation, if you want non-corrupt data, you must have more than 1 row returned for the same title. Returning a single row with the title and one of the links or one of the prices is giving you a corrupt dataset. If the link and price are the same for all rows with the same title, SELECT DISTINCT title, link, price will do what you want. (You can't have a distinct non-distinct dataset - there's no such thing.)