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.
Author |
Topic |
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-10-14 : 03:00:53
|
Hi ..Here is my table formatid price merchant updated_date93691 0.00 waterfilterexchange 14/10/1093691 0.00 J&R 14/10/1093691 17.57 Amazon.com 14/10/1093692 17.57 J&R 14/10/1093692 0.00 Amazon.com 14/10/1093692 0.00 waterfilterexchange 14/10/1093691 0.00 waterfilterexchange 8/10/1093691 0.00 J&R 8/10/1093691 17.57 Amazon.com 8/10/1093692 17.57 J&R 8/10/1093692 0.00 Amazon.com 8/10/1093692 0.00 waterfilterexchange 8/10/1093693 0.00 Amazon.com 8/10/1093693 0.00 shop 8/10/1093692 17.57 J&R 7/10/1093692 0.00 Amazon.com 7/10/1093692 0.00 waterfilterexchange 7/10/10I want to select the details of waterfilterexchange if id matches then all the details must be selected..condition here last 7 days record only selected..output93691 0.00 waterfilterexchange 14/10/1093691 0.00 J&R 14/10/1093691 17.57 Amazon.com 14/10/1093692 17.57 J&R 14/10/1093692 0.00 Amazon.com 14/10/1093692 0.00 waterfilterexchange 14/10/1093691 0.00 waterfilterexchange 8/10/1093691 0.00 J&R 8/10/1093691 17.57 Amazon.com 8/10/1093692 17.57 J&R 8/10/1093692 0.00 Amazon.com 8/10/1093692 0.00 waterfilterexchange 8/10/1093693 0.00 Amazon.com 8/10/10 |
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-10-14 : 04:26:48
|
Try this:Select id,price,merchant, updated_date from yourtable where id in(Select id from YourTable where updated_date >= dateadd(d,-7,dateadd(d,datediff(d,0,getdate()),0))and merchant ='waterfilterexchange') |
 |
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-10-14 : 05:32:19
|
Tx for your reply ..I'll report the answer.. |
 |
|
jafrywilson
Constraint Violating Yak Guru
379 Posts |
Posted - 2010-10-14 : 06:15:10
|
Thank you ..I got my required output .. |
 |
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-10-14 : 06:21:32
|
quote: Originally posted by jafrywilson Thank you ..I got my required output ..
You are welcome |
 |
|
|
|
|