Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OR? 4

Status
Not open for further replies.

Stevehewitt

IS-IT--Management
Jun 7, 2001
2,075
GB
Hi Guys,

I'm a bit of a newbie when it comes to this so please bare with me.

I've got a standard Access query, which currenly has one criteria which is to list our product type. (Click)
All works fine and this is all in the one table, but I need it to do a bit more than just the one criteria.

Basically I need it to be something like:

Code:
Select * FROM tablename WHERE "Product" = 'click' AND WHERE "StartDate" = '31/03/2005' OR WHERE "EndDate" = '31/03/2005';

I know that the above is incorrect as I don't really know SQL, however I need the query ensure that all results are listed as product type "CLICK" and either the start or the end or even both the dates are 31/03/2005. (It will actually be =Date() but for simplicity..!)

How do I go about this using the Access query builder? Like I said, I don't know SQL but I can't get the bloody thing to work in Access Query Builder!!!

Thanks in advance,


Steve.

 
In the SQL pane of the query window:
SELECT *
FROM tablename
WHERE Product='click' AND (StartDate=#2005-03-31# Or EndDate=#2005-03-31#);

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
you only type WHERE once, then just join your conditions with AND or OR and parens where needed. Paste this in SQL View:

Code:
Select * FROM tablename WHERE Product = "click" AND (StartDate = #31/03/2005# OR EndDate = #31/03/2005#);

Leslie

In times of universal deceit, telling the truth will be a revolutionary act. - George Orwell
 
erm, probably easier to edit the sql directly in this instance...

in fact, you are VERY close...

SELECT * FROM tblName WHERE Product ='click' AND ( StartDate = #date# OR EndDate = #Date#);

note where the '' and ## are placed. You only need to put them around strictly info strings, not around field names.

--------------------
Procrastinate Now!
 
You only need one WHERE clause:
Code:
Select * FROM tablename WHERE Product = 'click' AND (StartDate = #31/03/2005# OR EndDate = #31/03/2005#);

You don't need all of the "'s round the fields and it is (in my experience) good practise to enclose the OR statement in brackets.

And I know it's not important as you are using Date() but enclose dates in #'s.

Hope this helps

Harleyquinn

---------------------------------
For tsunami relief donations
 
are we on the ball this morning or what???

Cudos to us!

Les
 
you're absolutely right, I had never really thought about how it was spelled. Turns out that 'kudos' is the singular form and has been incorrectly used as a plural!

les
 
But dictonary.labortalk.com says:

Kudos (always plural) has two main meanings:

"fame and renown resulting from an act or achievement; prestige" thus by logical extension is often used as a praising remark.
A points system in the computer game Project Gotham Racing and its sequel, Project Gotham Racing 2, whereby one accrues points by outstanding driving, including performing slides, overtaking, and "getting a good line around a corner".
...
Origin
Apparently the word originated from the Greek ????? (kydos, meaning wonder, in the sense of awe) and entered English as British university slang in the early 1800s. Frequently used by Time magazine it came to America in the 1920s and 1930s.
 
did you read the link I provided?

Usage Note: Kudos is one of those words like congeries that look like plurals but are etymologically singular. Acknowledging the Greek history of the term requires Kudos is (not are) due her for her brilliant work on the score. But kudos has often been treated as a plural, especially in the popular press, as in She received many kudos for her work. This plural use has given rise to the singular form kudo. These innovations follow the pattern whereby the English words pea and cherry were shortened from nouns ending in an (s) sound (English pease and French cerise), that were mistakenly thought to be plural. The singular kudo remains far less common than the plural use; both are often viewed as incorrect in more formal contexts. ·It is worth noting that even people who are careful to treat kudos only as a singular often pronounce it as if it were a plural. Etymology would require that the final consonant be pronounced as a voiceless (s), as we do in pathos, another word derived from Greek, rather than as a voiced (z).
 
Unbelievable. I've been a member of TT for a good few years and this forum is hot. Nice one guys.

A star for all - much appreciated.

One little thing - if I was doing it in normal Access Query Builder I would not put down an acutal date, but instead =Date() - how do I do this in SQL?

Thanks again guys,

Steve.
 
Spot on. Thank you all very much.
I'm sure you'll be hearing back from me with some new threads whilst I play with Access! :)

Cheers again,


Steve.
 
Stevehewitt said:
and this forum is hot. Nice one guys.

only cos the answer was a simple one, if it was complicated, I wouldn't have answewred so quickly :)

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top