Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
5.x-1.6-beta5
Component:
user data
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
2 Jun 2008 at 10:07 UTC
Updated:
19 Apr 2009 at 00:55 UTC
I have a view that I'd like to filter by uid, so that it only shows one node per user. I've posted in the forum but my topic quickly got lost among all the others. Hoping someone will notice this here.
I've made some changes to my views_user.inc but they didn't help...
Comments
Comment #1
merlinofchaos commentedThis kind of query isn't really possible with Views.
Comment #2
norio commented@merlinofchaos,
Thanks for your reply! Much appreciated :)
I'm a seasoned PHP developer so I'd be happy to code something up that would make it possible with views. If you could take a look at my code here and let me know what I'm doing wrong (I'm new to the views API), I would be able to cook something up and post it here for everyone to use.
Comment #3
norio commentedSeriously happy to take this on, if you could spare me some basic advice.
Comment #4
merlinofchaos commentedUnfortunately, it's really hard to do with SQL, as in, I've never come up with a good way to do it. Sometimes you can do it using GROUP BY (which Views supports only very, very poorly) but once you GROUP BY you pretty much lose access to fields that you aren't grouping on, except for calculations. You can't really specify just one record out of everything that's being grouped.
Generally I've had to resort to multiple queries to do stuff like that, and that means not using Views. Sorry.
Comment #5
norio commentedOkie dokes, thanks in any case :)
Comment #6
carnage_ commentedsurely DISTINCT (uid) Would do the job?
Comment #7
merlinofchaos commentedUnfortunately, Views doesn't support that. I also suspect that in the real world, it would probably only work sometimes. MySQL seems to be fussy about distinct.
Comment #8
sunConsider upgrading to 6.x, please.
Comment #9
doublejosh commentedCan I do this in Views 2 without the Views Group By module?