Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 select query conditions

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2010-03-18 : 10:01:02
SELECT DISTINCT A.ProgID, A.ProjID, A.ContractID, A.PMNo, A.PMTypeID, A.PMID, A.Agency,
A.PMTitle, A.Deleted
FROM TAB_NetPM AS A inner join TAB_UserAccess AS B on (A.contractid=B.contractid and b.username='jSmith')
WHERE A.Deleted = 0

Is it possible to add this condition to above query to also get records where element=1.

Or else should i just use the union query?

Thank you very much for the helpful info.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-18 : 10:08:12
WHERE A.Deleted = 0
or element = 1


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2010-03-18 : 10:29:34
No, it didn't work.

The top query should get 27 records and with this condition added should get 1 extra, so total 28 records.

When i used or element=1 it brought 33 rows, but now row has element=1.
it brought someother rows.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-18 : 10:38:34
example data?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -