Query to check a field and select fields from a table

I have 2 tables (tServers and tTimezone) with the following structure:

tServers:
servername
city

tTimezone:
city
time1
time2

My query need to check if [tServers].servername is like "*DOWD*" and
return a field "time" populating with [tTimezone].time2. I joined both 
tables using city. 

0
Rodrigo
6/7/2007 11:53:08 AM
access.queries 6343 articles. 1 followers. Follow

3 Replies
963 Views

Similar Articles

[PageSpeed] 49

"Rodrigo Borges" <rsborges@hotmail.com> wrote in message 
news:D955F76E-0CCD-4B16-8E01-B7768189A119@microsoft.com...
>I have 2 tables (tServers and tTimezone) with the following structure:
>
> tServers:
> servername
> city
>
> tTimezone:
> city
> time1
> time2
>
> My query need to check if [tServers].servername is like "*DOWD*" and
> return a field "time" populating with [tTimezone].time2. I joined both 
> tables using city.

SELECT tTimezone.time2
FROM tServers INNER JOIN tTimezone ON tServers.city=tTimezone.city
WHERE tServers.servername LIKE "*DOWD*";

Carl Rapson


0
Carl
6/7/2007 3:09:56 PM
I do need to use a condicional because I have more than 1 information to 
check...

exampe: if servername like "*dowd*" = time2, if servername like *dowb* = 
time1....

Tks for your reply Carl and soory for do not provide these information 
before...

"Carl Rapson" <mr.mxyzptlk@newsgroups.nospam> wrote in message 
news:#Gp$1XRqHHA.484@TK2MSFTNGP06.phx.gbl...
> "Rodrigo Borges" <rsborges@hotmail.com> wrote in message 
> news:D955F76E-0CCD-4B16-8E01-B7768189A119@microsoft.com...
>>I have 2 tables (tServers and tTimezone) with the following structure:
>>
>> tServers:
>> servername
>> city
>>
>> tTimezone:
>> city
>> time1
>> time2
>>
>> My query need to check if [tServers].servername is like "*DOWD*" and
>> return a field "time" populating with [tTimezone].time2. I joined both 
>> tables using city.
>
> SELECT tTimezone.time2
> FROM tServers INNER JOIN tTimezone ON tServers.city=tTimezone.city
> WHERE tServers.servername LIKE "*DOWD*";
>
> Carl Rapson
>
> 
0
Rodrigo
6/8/2007 12:00:22 AM
I don't think that can be done in a query, because you can't conditionally 
specify the fields to be selected. It would be fairly simple in VBA code.

Carl Rapson

"Rodrigo Borges" <rsborges@hotmail.com> wrote in message 
news:8F95EFB2-66DF-42BC-8D03-E4D7E022E92A@microsoft.com...
>I do need to use a condicional because I have more than 1 information to 
>check...
>
> exampe: if servername like "*dowd*" = time2, if servername like *dowb* = 
> time1....
>
> Tks for your reply Carl and soory for do not provide these information 
> before...
>
> "Carl Rapson" <mr.mxyzptlk@newsgroups.nospam> wrote in message 
> news:#Gp$1XRqHHA.484@TK2MSFTNGP06.phx.gbl...
>> "Rodrigo Borges" <rsborges@hotmail.com> wrote in message 
>> news:D955F76E-0CCD-4B16-8E01-B7768189A119@microsoft.com...
>>>I have 2 tables (tServers and tTimezone) with the following structure:
>>>
>>> tServers:
>>> servername
>>> city
>>>
>>> tTimezone:
>>> city
>>> time1
>>> time2
>>>
>>> My query need to check if [tServers].servername is like "*DOWD*" and
>>> return a field "time" populating with [tTimezone].time2. I joined both 
>>> tables using city.
>>
>> SELECT tTimezone.time2
>> FROM tServers INNER JOIN tTimezone ON tServers.city=tTimezone.city
>> WHERE tServers.servername LIKE "*DOWD*";
>>
>> Carl Rapson
>>
>> 


0
Carl
6/8/2007 2:52:48 PM
Reply:

Similar Artilces:

TempVars unusable in field default value
Hello, I'm trying to use a temporary variable to keep track of which CSR is inputting data. I have a macro which prompts user for ID code, which is stored in the temp variable TempUser. On a form control default value property, I can use the expression [TempVars]![TempUser], which will populate that user's ID code into the control. However, I cannot use that same expression in the tables field default value property. If I try, when I save the changes to the table, I get the error message "Could not find the field 'TempVars]![TempUser'. " Any ideas why I ca...

Proper Table(s) Layout
I have created a couple of Dbs which the table structure seemed to simply fall into place, it was just logical in my head. That said, I am working on a new db and for some reason I am doubting myself and wanted a second opinion. The db is basically a contract db to input all the info, and there is a lot of info, for each contract. Where I am 'lost' is the fact that the contracts are broken into categories: clients, components,engineering, warantee... For all of the components (with the exception of clients) there are a number of fields but only 1 entry per contract....

send the same e-mail with one or two fields changed.......
I would like to send the same e-mail to many differnet people with one or two fields changed (for example the name of recipient and the date).How canthis be done?? I would also like to be able to save the e-mail and use it again and again. can anyone help cheers john If you have Word installed and it's the same version as Outlook (both 2003, for example), you can do a mail merge between the two. This would allow you to set up the text the way you want it to, and you can save the document for future use. Look at the following page for further information: http://www.slipstick.com/con...

Queries and Charts
Does anyone know why the expressions in queries work fine for reports but not charts? ...

Table link documentation
I am having trouble trying to locate A/P check data that has project related costs. I found the check data but it is does not indicate the projects, I found the project data but can not determine thye logical link between the two tables, I may be using the wrong tables the tables I am using are PM80500 and PA31102. Is there any documentation of how all the tables in the system are logically link. I am trying to write reports in MS Access, but there are 1500+ tables in GP (version 10) -- Dave F In an effort to find the correct table you can do a number of things (believe me I do)....

Pass parameter from FORM to QUERY
I have an append query that I trying to call from a cmd btn...but it prompts me for the parameter(ie QuoteID)... How do I tye it into my call: Dim stQueName As String stQueName = "Quote Query" DoCmd.OpenQuery stQueName, acNormal, acEdit On Apr 13, 12:56 pm, jlt...@hotmail.com wrote: > I have an append query that I trying to call from a cmd btn...but it > prompts me for the parameter(ie QuoteID)... > How do I tye it into my call: > > Dim stQueName As String > stQueName = "Quote Query" > DoCmd.OpenQuery stQueName, acNormal, acEd...

Field Service Calls and Invoices
We use the Service Call modules for repairs in our Stores and have a situation that I'm trying to find a workaround. We have situations where our technicians will pick-up items without prior notification to our dispatchers. All of a sudden we get an invoice and currently we have to track down the charge and then we are forcing a PO into the system from the Service Call in order to properly receive and enter the invoice. Does anyone have other ways to do this and track the information/cost on the Service Call without needing to create a PO after the fact. This is not an applicat...

Duplicate record in RM tables
We experienced an issue in Apply Sales Document that may have caused a duplicate record somewhere. We found this when running Paid Sales Transaction Removal and received this message: Violation of PRIMARY KEY contraint PKRM3101. Cannot insert duplicate key in object RM30101. I ran the RM duplicate tool found in the automated help area of this website and found the following: --- Begin copy here ---- Duplicates between RM Open and RM History Document #: 07-003021-17 Customer #: 079100 RMDTYPAL #: 7 --- End copy --- It looks like the duplicte tool also logs the qu...

How do I copy the result of a check box into another check box?
I'm trying to copy the result of a "check box form field" into another check box. For example: if I check (or uncheck) one box in a form, another box later in the protected form will also be checked (or unchecked) , much like the ref + F9 command for the text form field. Is this possible? Thanks. This cannot be done without macros. If your project will allow macros - see http://word.mvps.org/faqs/tblsfldsfms/ExclusiveFmFldChbxs.htm -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> G...

Changing query execution sequence
Hi all, I got a spreadsheet which would execute a bunch of queries. It's noted that the queries are executing in the sequence of when it was added to the spreadsheet. Does anyone out there know of a way to switch the order without deleting and recreating them? Thanks! Wing ...

Global distribution List Not Appearing in Outlook Global Selections list
I have created a global list in AD in Server 2003 ( using Exchange 2003) and assigned my users. For some reason the list is not showing in the Outlook client global address list. I have compared this list to others i have created in the past and cannot spot any differences. What am I missing? 1. Have you got it hidden from the GAL? 2. Using cached Exchange mode? Therefore requiring a rebuild of the OAB to see it? Oliver On Fri, 16 Feb 2007 13:24:05 -0500, "rlm" <rmorton@execpc.com> wrote: >I have created a global list in AD in Server 2003 ( using Exchange 2003...

Select Nodes
I am using the XmlDocument Select Nodes method and it seems to work OK except that it returns embedded nodes in the collection when I only want the nodes that are not embedded. For example I have a statement as follows: nodes = doc.SelectNodes(\\Node1\\Node\\DesiredNode); It gives me back in the collection all the DesiredNode tags. If I select retrieve the nth node as follows node = nodes[n-1]; It gives me the correct node and all DesiredNodes that are embedded within the nth node. So if I ask for the first node it gives me the first node which includes about 5 embedded DesiredNode...

Check out that pack from the Microsoft Corp.
--llhgxblnry Content-Type: multipart/related; boundary="broryxkaxlyu"; type="multipart/alternative" --broryxkaxlyu Content-Type: multipart/alternative; boundary="sugmntysaz" --sugmntysaz Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Client this is the latest version of security update, the "September 2006, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to continue keeping your computer secure from these vulnerab...

Dynamic Range Selection Using VBA
What I'm trying to accomplish is to be able to run a procedure that selects a range based on a number provided in another cell. For example; if the number 10 is in cell A1, then cells A20:A30 would be selected when I run the macro. If the number 6 is provided, then cells A20:A26 would be selected. Not sure where to start, so any help is appreciated. this may do what you want range("A20").Resize(range("A1").Value+1).select -- Gary Keramidas Excel 2003 "TEK" <TEK@discussions.microsoft.com> wrote in message news:DA9FFF99-FC28-...

Can the data in a chart table be right justified?
Ecxel 2003 and previous versions of the product center the data in the data columns. Can the data in the columns of a chart table be right justified? In article <DABF738B-6C0D-458B-B082-FA9BD8F126A7@microsoft.com>, =?Utf- 8?B?c2FtIGVhZ2xl?= <sam eagle@discussions.microsoft.com> says... > Ecxel 2003 and previous versions of the product center the data in the data > columns. Can the data in the columns of a chart table be right justified? > Have you tried to format the table? If yes, and you haven't been successful it is probably because XL allows very limited cust...

140 MB file went to 5.08 MB after editting 1 table
Hello All - I need some ACCESS insight...please... Several years ago, I built an access db to track my business scheduling and accounts payable/receivable. So this database is EXTREMELY IMPORTANT TO ME. The file has grown to 140 MB. Today I made a copy of the file and then edited my calendar table. I removed all columns which had 2006 data (72 totals columns) - the table had about 144 columns originally. I then added 72 columns with 2008 headers. These columns are now blank since I have not added any 2008 data yet. Afterwards, I looked around and everything looks good - my 2007 data is the...

Pivot Table Defaults
In the pivot table field list, whenever I create a new pivot table and I am inserting fields into the value area, I generally get as default field setting the 'Count' value. Is there a way to format the spreadsheet to make Excel recognize the data as all numbers so it defaults to the "Sum" function as opposed to "text"? Hi The rule that the PT Wizard adopts is, If all the values in the field being added to the data area are Numeric, then it uses Sum. If any of the values are Text or BLANK, then it uses Count. It sounds as though you have defin...

Like a pivot table
Hello every body I'm first time requesting in this group, so I opologize in advance for any mistakes or something annoying I repeat what I have sent before 10 min because I see it unclear when it goes to news group If any one can help me I'm working with data which most of it comes like a table with feilds as columns and records as rows. I want it to be as many rows with each feild an example what is exist name age Joining Date Tele John 20 Jun-90 4321251 Iqbal 30 Jul-95 6583752 George 40 Sep-85 7843125 What I wa...

Request Selection
Hi, if we try to assign an activity to an open Request there are all Requests available (include closed). is there a way to show only open requests in this select-formular ? regards armin ...

multiple iterations of same query
Running Access 2003 on Vista. I have a query that chooses 15 records at random. This works fine. What I want to do is run the same query for approx 110 different users, each with their own randomly selected 15 records. Obviously, I want to avoid manually running the same query that many times. How can I get around this? Post your query SQL. -- Build a little, test a little. "Nathan" wrote: > Running Access 2003 on Vista. > > I have a query that chooses 15 records at random. This works fine. > > What I want to do is run the same query fo...

Duplicating one Field from One table to Another
Hi - I have two tables - one position, one personnel - which has a 1-to-many relationship (1 position record to many personnel records). The department had a new requirement which made it necessary to change some coding (I inherited this). I'm using tab forms so that when a position is pulled up, you can click on the tab that has the personnel information (if there is any). There is a button on the Personnel form that allows the user to add a new Personnel record. Since I am using an Auto-number field in the Position table (which doubles as the PK) the functionality is fine. Wh...

modifying and copying multiply selections
Why when I select multiply objects, including text boxes or when I try to select them and then drag to a different locations the program just create a new copy but leaves the old one behind it? It didn't happen when I was working with other versions of Power Point. I think http://www.pptfaq.com/FAQ00882.htm will help. -- Echo [MS PPT MVP] http://www.echosvoice.com What's new in PPT 2010? http://www.echosvoice.com/2010.htm Fixing PowerPoint Annoyances http://tinyurl.com/36grcd PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx "Slav" <Sl...

How to show query parameters on an Excel page header or worksheet?
Is it possible to display query parameters on a page header or on a worksheet? I have a worksheet that uses a query to retrive data from an ODBC database. The Query prompts for the Start Date and End Date. I would like to be able to print the worksheet and display the Start Date and End Date the user typed in. Thank you for your assistance. ...

Memo Field Not pasting correctly in XL
I tried a search and couldn't find an answer. If there is an answer to this already please point me to it. I'm simply copying the record in Access and trying to paste it into XL. The problem that I'm having is one of the fields does not fully paste into XL. It is a memo field and has 539 characters. I'm only getting 255 when I try to paste the record in XL. I've tried copying just the contents of the cell and that worked fine. It seems as if I'm running into some sort of limitation. Does anyone know anything about this and is there a way to get around it? I checke...

Pivot Table Summary Error?
Greetings, Sorry, wasn't sure which subforum to post this in, as there's nothing dedicated to pivot table. My dilemma is as follows: I have a spreadsheet where data is entered daily. For my example, just imagine a spreadsheet with three columns: date, date, delay. Two date columns are used for the pivot table. The pivot table is displayed with month and weekly ranges as the row headers. There is a field in the pivot table that is summarized as a MAX of one of the source data columns. Now, the problem I am coming across is the monthly summary MAX is not c...