Showing posts with label userid. Show all posts
Showing posts with label userid. Show all posts

Thursday, March 22, 2012

Joining two Queries

Right now I have two Queries that I've created:
What I'm wanting to do is graft everything from Query1 onto Query2 but only where Query1.UserID = Query2.UserID . Any suggestions on how I would go about doing this?

--Query 1
(
SELECT
PC1.ID,
PC1.UserID,
PC1.ModuleID,
PC1.ModifiedDate
FROM
Projex2_0_0_Cores PC1
WHERE
PC1.ModuleID = 369
)

--Query 2
(
SELECT
PC2.UserID,
MAX(PC2.CreatedDate) as CreatedDate
FROM
Projex2_0_0_Cores PC2
WHERE
PC2.ModuleID = 369
GROUP BY
PC2.UserID,
PC2.ModuleID
)Was the following query not helpful for this situation?

http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=840226|||Lol. Thanks. For some reason ASP.NET didn't email me letting me know there was a reply.

Thanks so much!
-Tony Valenti|||I'm also needing to be able to do the same thing, except grab all the rows where the CreatedDate != Max(CreatedDate).

Here's my scenerio, and maybe you know a better way:

I have a table of serialized objects (Cores). In the table I want a users to be able to have as many entries as they want, but only one active entry. I'm currently trying to use CreatedDate to find out what the active entries are:
CreatedDate = Max(CreatedDate) == Active
CreatedDate != Max(CreatedDate) == Archived

I have a stored procedure that I want to be able to pass 3 parameters: ModuleID (int), Active (bit), and Archived (bit). If I pass active =1 archived=1, I get all the records for that moduleID (easy), but if only one of them is true, then I only want the actives or the archives.

How would you do this?

Thanks!|||write a little if statement in your stored proc.


--Assuming you have default values of 0's for both params Active and Archived..
IF Active = 1 AND Archived = 1 THEN
'your select query that returns all rows
ELSE IF Active = 1 AND Archived = 0 THEN
'your query with where condition CreatedDate = Max(CreatedDate)
ELSE IF IF Active = 0 AND Archived = 1 THEN
'your query with where condition CreatedDate <> Max(CreatedDate)
END IF

Thursday, February 9, 2012

(Single) Subscription and security filtering

Hi,
I have a report (created in Report Builder) which has a security
filter in it (based on userid). I would like to be able to have users
subscribe to it and get only the data they ought to see. However,
since I have to save the credentials in order to render the report
automatically (in subscription) - security filtering doesn't work
right, because the users' credentials aren't use.
Is there any way I can make this work?
Thanks in advance,
R. GreenAnyone please?
On Jul 3, 7:36 pm, Ronald Green wrote:
> Hi,
> I have a report (created in Report Builder) which has a security
> filter in it (based on userid). I would like to be able to have users
> subscribe to it and get only the data they ought to see. However,
> since I have to save the credentials in order to render the report
> automatically (in subscription) - security filtering doesn't work
> right, because the users' credentials aren't use.
> Is there any way I can make this work?
> Thanks in advance,
> R. Green|||Ronald,
Did you ever get an solution for this? i am trying to do something similar.
Ryan
"Ronald Green" wrote:
> Anyone please?
> On Jul 3, 7:36 pm, Ronald Green wrote:
> > Hi,
> >
> > I have a report (created in Report Builder) which has a security
> > filter in it (based on userid). I would like to be able to have users
> > subscribe to it and get only the data they ought to see. However,
> > since I have to save the credentials in order to render the report
> > automatically (in subscription) - security filtering doesn't work
> > right, because the users' credentials aren't use.
> >
> > Is there any way I can make this work?
> >
> > Thanks in advance,
> > R. Green
>
>