Solved

Need a Quick SQL Query

Posted on 2011-02-22
4
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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