PC Review


Reply
Thread Tools Rate Thread

COMPARE FIELDS QUERY

 
 
Simon Gare
Guest
Posts: n/a
 
      22nd Jan 2006
Hi

I need a query that searches 2 fields in 2 tables. Below is an example.

There are 2 numeric fields in each of the 2 tables containing numbers such
as 51.565842 in 1 field and -0.331336 in another . I need the query to
search the other table and to compare the first 3 digits ie 51.5 and -0.33
and return a result, if that result returns more than 1 record then the
query searches the next digit ie 51.56 and -0.331 and so on until only 1
record is returned.

I know this may sound complicated, but i really need help on this one.

Thanks in advance.

Simon Gare



 
Reply With Quote
 
 
 
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      22nd Jan 2006
You can easily do this with 3 queries:

Query1:
SELECT Max(Table1.First) AS MaxOfFirst
FROM Table1;

Query2:
SELECT Max(Table2.Second) AS MaxOfSecond
FROM Table2;

Query3:
SELECT Query1.MaxOfFirst, Query2.MaxOfSecond,
IIf([MaxOfFirst]>[MaxOfSecond],[MaxOfFirst],[MaxOfSecond]) AS Largest
FROM Query1, Query2;
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access


"Simon Gare" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi
>
> I need a query that searches 2 fields in 2 tables. Below is an example.
>
> There are 2 numeric fields in each of the 2 tables containing numbers such
> as 51.565842 in 1 field and -0.331336 in another . I need the query to
> search the other table and to compare the first 3 digits ie 51.5 and -0.33
> and return a result, if that result returns more than 1 record then the
> query searches the next digit ie 51.56 and -0.331 and so on until only 1
> record is returned.
>
> I know this may sound complicated, but i really need help on this one.
>
> Thanks in advance.
>
> Simon Gare
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare 2 fields from 1 query =?Utf-8?B?RE4=?= Microsoft Access Queries 0 6th Aug 2007 03:42 PM
COMPARE FIELDS QUERY Simon Gare Microsoft Access ADP SQL Server 1 22nd Jan 2006 05:03 PM
COMPARE TWO FIELDS IN A QUERY =?Utf-8?B?ZGF6YW5vbmU=?= Microsoft Access Queries 1 13th Jul 2005 07:54 PM
Compare fields in query ds Microsoft Access Queries 4 1st Oct 2004 12:00 AM
how compare to fields to see if different in query? Marty Microsoft Access 0 6th Aug 2003 12:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:36 PM.