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 |
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-05-17 : 10:57:33
|
| How can I actually pull out the date for those price on chicken, fish and mutton delivered on certain date. And all price on other than chicken, fish and mutton bought on any date. But the date of purchased need to be same. I did this but get error on 'and'select .. from ..where (price in ('chicken','fish','mutton') and deliverdate between '2012-05-11' and '2012-05-13') or and boughtdate between '2012-05-11' and '2012-05-13' |
|
|
vijays3
Constraint Violating Yak Guru
354 Posts |
Posted - 2012-05-17 : 11:03:56
|
| If your logic is correct Try this .You had syntax issue:select * from empwhereprice in ('chicken','fish','mutton') and deliverdate between '2012-05-11' and '2012-05-13'Vijay is here to learn something from you guys. |
 |
|
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-05-17 : 11:06:47
|
| but i still want those vegetables, chillies, etc that bought between '2012-05-11' and '2012-05-13'. And dont care when is the deliverdate. The deliverdate is basically just for 'chicken','fish','mutton'. can i do that? |
 |
|
|
malpashaa
Constraint Violating Yak Guru
264 Posts |
Posted - 2012-05-17 : 11:36:42
|
Try this:select .. from .. where price NOT IN ('chicken','fish','mutton') OR deliverdate between '2012-05-11' and '2012-05-13'For us, there is only the trying. The rest is not our business. ~T.S. EliotMuhammad Al Pasha |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2012-05-17 : 12:06:49
|
| Maybe it's time for some DDl, DML and expected output. Here are some links that can help you prepard that:http://www.sqlservercentral.com/articles/Best+Practices/61537/http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2012-05-17 : 12:15:53
|
| mutton? |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2012-05-17 : 12:27:39
|
quote: Originally posted by X002548 mutton?
Its meat in English but is called mutton in Indian languages.After Monday and Tuesday even the calendar says W T F .... |
 |
|
|
|
|
|
|
|