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 2008 Forums
 Transact-SQL (2008)
 Query Help

Author  Topic 

Yonkouturko
Yak Posting Veteran

59 Posts

Posted - 2012-12-04 : 02:45:44
i'm experimenting in SQL Select statements

I have this code
"
SELECT RecordID, JobOrder#, RequestBy, Transactions, Description, Remarks, Status, Date_Scheduled, StartDate, StartTime, EndDate, EndTime,
DR#, PO#, OR#, SI#, Amount
FROM tblMonitoring
WHERE (Employee = @EMP) AND(Status = 'On-Hand' OR
Status = 'Update')
UNION ALL
SELECT RecordID, JobOrder#, RequestBy, Transactions, Description, Remarks, Status, Date_Scheduled, StartDate, StartTime, EndDate, EndTime, DR#, PO#, OR#, SI#,
Amount
FROM tblMonitoring
WHERE (StartDate = @DATE) AND ( (Employee = @EMP) AND (Status <> 'Finished' OR Status <> 'Cancelled' OR Status <> 'Failed'))
ORDER BY StartDate DESC
"

and im getting redundant Lines in my view
but my entry in dbase is just single...
and its view has redundant... can someone help me with this...

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-12-04 : 02:48:07

Use UNION instead of UNION ALL

--
Chandu
Go to Top of Page

Yonkouturko
Yak Posting Veteran

59 Posts

Posted - 2012-12-04 : 02:49:50
tnx bandi ill give it a try!
Go to Top of Page

Yonkouturko
Yak Posting Veteran

59 Posts

Posted - 2012-12-04 : 02:51:32
it worked perfectly thank you for your help!!!
bandi
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-12-04 : 03:25:48
quote:
Originally posted by Yonkouturko

it worked perfectly thank you for your help!!!
bandi




Welcome

--
Chandu
Go to Top of Page
   

- Advertisement -