• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

Two WHEREs in a SQL Query?

I have a select statement where I need to have two WHERE conditions satisfied. What is the syntax for that?

Here's the statement I'm using -- it generates an "invalid syntax" error, probably due to my use of "and"...?

select * from [Auct-PMT] where EbayNum = 'Me.EbayNum.Value' and where [Date-Time] = 'Me.AuctionPmt_Subform![Date-Time]'

(This SQL code appears in one of my MS Access form events, hence the reference structure.)
0
Galisteo8
Asked:
Galisteo8
1 Solution
 
sigmaconCommented:
remove second WHERE
select * from [Auct-PMT] where EbayNum = 'Me.EbayNum.Value' and [Date-Time] = 'Me.AuctionPmt_Subform![Date-Time]'
0
 
stewartwbCommented:
Just drop the second WHERE... you simply separate the expressions with logical AND or OR operators.

select * from [Auct-PMT] where EbayNum = 'Me.EbayNum.Value' and [Date-Time] = 'Me.AuctionPmt_Subform![Date-Time]'

-- Brian
0
 
Galisteo8Author Commented:
<slapping forehead> Oh yeah!  Many thanks for answer as well as speed.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now