If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Selecting one value rather than both..

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-03, 05:29
130213 130213 is offline
Registered User
 
Join Date: Oct 2003
Posts: 58
Question Selecting one value rather than both..

Hi,

May be a stupid question but i have a small DB built in Access, and one of my fields "Work Place" has TWO "Contacts" associated to it each owning a different "Contact Type".

What i would like to do is to view all the "Work Places" and their "Contacts" "Contact Types", but

instead of showing both "Contacts" and their "Types" which are at the same "Work Place", I would like to say that if both "Contacts" and their "Types" are at a particular "Work Place" then still show all of the "Work Places" but Choose one particular "Type" over another, and show one only.

somebody help, its driving me nuts,

Ive tried: "type1" OR "type2" in the criteria field but this just displays both..

Any help would be appreciated.
Reply With Quote
  #2 (permalink)  
Old 10-08-03, 19:10
christodd christodd is offline
Registered User
 
Join Date: Oct 2003
Posts: 16
Re: Selecting one value rather than both..

Quote:
Originally posted by 130213
Hi,

May be a stupid question but i have a small DB built in Access, and one of my fields "Work Place" has TWO "Contacts" associated to it each owning a different "Contact Type".
Not stupid at all... what you need to do is GROUP BY the workplace and ORDER BY the Contact Type. Something like

SELECT WorkPlace, ContactName, ContactType
FROM Contacts
GROUP BY WorkPlace
ORDER BY ContactType

Unless you are doing a join, then you can use other magic

-Chris
Read my SQL tutorial at http://www.bitesizeinc.net/index.php/sql.html
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On