Solved

Need a Quick SQL Query

Posted on 2011-02-22
4
237 Views
Last Modified: 2012-05-11
One Table called Orders.

ORDERID, ORDERDATE, SHIPSTREET, SHIPCITY, SHIPZIPCODE

I need to return all fields where
ORDERDATE BETWEEN  #1/1/2011# and #1/31/2011#
AND
COUNT(SHIPSTREET) > 1

Thanks

0
Comment
Question by:LanBuddha
  • 2
4 Comments
 
LVL 18

Expert Comment

by:sventhan
ID: 34954913
select ORDERID, ORDERDATE, SHIPSTREET, SHIPCITY, SHIPZIPCODE
from orders
where ORDERDATE BETWEEN  '2011-01-01' and '2001-01-13'  
and count(shipstreet) > 1
0
 
LVL 18

Expert Comment

by:sventhan
ID: 34954932
select ORDERID, ORDERDATE, SHIPSTREET, SHIPCITY, SHIPZIPCODE
from orders
where ORDERDATE BETWEEN  '2011-01-01' and '2001-01-13'  
group by ORDERID, ORDERDATE, SHIPCITY, SHIPZIPCODE
having count(shipstreet) > 1
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 250 total points
ID: 34954990
if you will run this in access


SELECT  OrderID, OrderDate, ShipStreet, ShipCity,ShipZipCode
FROM Orders
WHERE (((ShipStreet) In (SELECT [ShipStreet] FROM [Orders] As Tmp GROUP BY [ShipStreet] HAVING Count(*)>1 )) AND ((OrderDate) Between #1/1/2011# And #1/31/2011#))

0
 
LVL 2

Author Closing Comment

by:LanBuddha
ID: 34955104
Access chokes a little on this but return a result.

thanks much.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Suggested Solutions

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now