SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Query Help
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yonkouturko
Yak Posting Veteran

Philippines
59 Posts

Posted - 12/04/2012 :  02:45:44  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2218 Posts

Posted - 12/04/2012 :  02:48:07  Show Profile  Reply with Quote

Use UNION instead of UNION ALL

--
Chandu
Go to Top of Page

Yonkouturko
Yak Posting Veteran

Philippines
59 Posts

Posted - 12/04/2012 :  02:49:50  Show Profile  Reply with Quote
tnx bandi ill give it a try!
Go to Top of Page

Yonkouturko
Yak Posting Veteran

Philippines
59 Posts

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

bandi
Flowing Fount of Yak Knowledge

India
2218 Posts

Posted - 12/04/2012 :  03:25:48  Show Profile  Reply with Quote
quote:
Originally posted by Yonkouturko

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




Welcome

--
Chandu
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000