sasori Posted June 4, 2013 Share Posted June 4, 2013 Hi, I have a problem whereby I need to produce "only" one item per user e.g it's a portal that has many users and they can post alot of items, regardless whether it's a registered or non registered user. can someone give me a pseudo thing that may help solve this sql statement problem? or atleast an sql code snippet.. if I do this select userid, itemtitle, max(itemid) as ad from itemtable where status = 1 and expirydate > current_date and publishdate is not null and displaypublishdate is not null group by userid order by displaypublishdate desc; it throws an error in my sql developer ORA-00979: not a GROUP BY expression 00979. 00000 - "not a GROUP BY expression" *Cause: *Action: Error at Line: 33 Column: 15 it only produces results when i changed the "order by" into order by ad and removed the itemtitle among the selected columns but I need to order it by displayplublishdate or publishdate in descending order..and also I need to get the item title as well...because I need to display the item title in the front-end of the portal so how? Quote Link to comment https://forums.phpfreaks.com/topic/278765-oracle-db-how-to-get-unique-item-per-user/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.