Medrise
asked on
SQL DISTINCT not working
I have a query that I'm added ROW_NUMBER() to it, but when I try to add DISTINCT or GROUP BY it does not work.
Here is the query.
Here is the query.
SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY fpacode) AS Rownumber, fpaCode, listname, fpaID, emailTo, status, cfid FROM fpaBasket WHERE cfid = 'D1W12978461') AS Sample WHERE Rownumber < 11
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I want to add the ROW_NUMBER to this query, so should do a SELECT with ROW_NUMBER() with this query?
SELECT DISTINCT(fpaCode), listname, fpaID, emailTo, status, cfid FROM fpaBasket WHERE cfid = 'D1W12978461'
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I can return ROWNUMBER 4 that would be fine...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you provide some sample data and your expected output?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER