First, you really should be posting your questions in the correct forum. You are obviously using Microsoft SQL Server, so the correct forum would be: forum183
I see a couple things about your query that bothers me.
1. Don't use single quotes around column aliases. SQL server prefers square brackets. Obviously, this won't cause your query to fail, but it's a good habit to get in to.
[tt][blue]P.strProjectName [!][[/!]Name[!]][/!][/blue][/tt]
2. You should start using ANSI style joins in your where clause. For example, you have...
[tt][blue]FROM tblProject as P, tblUser as U
WHERE U.intUserID = P.int_fk_Manager[/blue][/tt]
Instead, you should use...
[tt][blue]
FROM tblProject as P
Inner Join tblUser as U
On U.intUserID = P.int_fk_Manager[/blue][/tt]
3. It appears as though
bitProjectIsActive is a bit field. To compare bit fields within T-SQL, you should use the values 1 or 2. Like this...
[tt][blue]and P.bitProjectIsActive = [!]1[/!][/blue][/tt]
Now, with that being said, I should point out that storing multiple userid's in multiple columns within a table is NOT normalized. Instead, you should create another table to store the id's. Think about it. Right now you are storing 7 id's with 7 different columns. What would happen if your customer wanted to store an 8th id? You would have to add another column and then change a bunch of code to accomodate the new column. If, instead, you created another table to store the id's, it would be as simple as adding another record to the table.
I do realize that often times people have no control over the structure of the database, so, the solution to your problem, with it's current structure would be...
Code:
[COLOR=blue]SELECT[/color] P.strProjectName [[COLOR=blue]Name[/color]],
P.strProjectDescription [[COLOR=#FF00FF]Desc[/color]],
P.strProjectNotes [Notes],
U.strUserFirstName + U.strUserLastName [[COLOR=blue]Name[/color]],
User1.strUserFirstName + User1.strUserLastName [[COLOR=blue]Name[/color] 1],
User2.strUserFirstName + User2.strUserLastName [[COLOR=blue]Name[/color] 2],
User3.strUserFirstName + User3.strUserLastName [[COLOR=blue]Name[/color] 3]
[COLOR=blue]FROM[/color] tblProject [COLOR=blue]as[/color] P
[COLOR=#FF00FF]Left[/color] [COLOR=blue]Join[/color] tblUser [COLOR=blue]as[/color] U
[COLOR=blue]On[/color] U.intUserID = P.int_fk_Manager
[COLOR=#FF00FF]Left[/color] [COLOR=blue]Join[/color] tblUser [COLOR=blue]as[/color] User1
[COLOR=blue]On[/color] P.UserId1 = User1.intUserId
[COLOR=#FF00FF]Left[/color] [COLOR=blue]Join[/color] tblUser [COLOR=blue]as[/color] User2
[COLOR=blue]On[/color] P.UserId2 = User2.intUserId
[COLOR=#FF00FF]Left[/color] [COLOR=blue]Join[/color] tblUser [COLOR=blue]as[/color] User3
[COLOR=blue]On[/color] P.UserId3 = User3.intUserId
[COLOR=blue]WHERE[/color] (@p1 [COLOR=blue]Is[/color] NULL Or P.int_fk_PortfolioID = @p1)
and P.bitProjectIsActive = 1
-George
Strong and bitter words indicate a weak cause. - Fortune cookie wisdom