Yea, you can. If I am having trouble with writing a query in coldfusion
for an access database, I make a copy of the database and open it in
Access and design the query in SQL view to test it. I did that with the
sub-select query below and it worked great. 

-----Original Message-----
From: Ben Nadel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 18, 2007 12:38 PM
To: CF-Newbie
Subject: RE: Query Question

I am not 100% sure of this, but since he is using an Access DB, I don't
think he can do fancy SQL like that. 


.......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/

-----Original Message-----
From: Michael Rigsby [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 18, 2007 12:20 PM
To: CF-Newbie
Subject: RE: Query Question

Ok, This might help. The query below will give you a list of all the
records in the new table that don't have a corresponding records of the
same last name in the old table. Does something like this help? 

SELECT *
FROM PlatMemNew
WHERE LastName NOT IN (SELECT LastName FROM PlatMemOld)

-----Original Message-----
From: John Eubanks [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 18, 2007 10:56 AM
To: CF-Newbie
Subject: Re: Query Question

Michael,

Many thanks.  Tried it and it didn't work.  The Primary key is just a
field called Id.  However, there are a different amount of records in
each table. One has a little over 700, the other has somewhere around
1400.

In a nutshell, this is what I am doing:  I have two tables with last
name, first name, and Id.  Only one table has a RegId (basically, just a
country identifier, because the other table doesn't need it right now).

I just need to compare the records, based on last name, and spit out the
ones that don't match.  The AND in the WHERE clause is just being used
for the RegId so that it just searches the names based on the country
(for example, U.S.).  You would think it would be pretty easy and
straightforward.

>Is RegID your primary key? Are you trying to compare multiple records 
>based on matching RegID? If so, you may want to try something like
this.
>
>
>SELECT PlatMemNew.*, PlatMemNew.LastName AS NewLastName, PlatMemOld.*, 
>PlatMemOld.LastName AS OldLastName FROM PlatMemNew, PlatMemOld WHERE 
>PlatMemNew.LastName <> PlatMemOld.LastName AND PlatMemOld.RegId = 
>PlatMemNew.RegId;
>
>You can use the AS statement so you can give the fields different names

>so its easier to address them in your query output.
>Hope this helps.
>
>
>-----Original Message-----
>From: John Eubanks [mailto:[EMAIL PROTECTED]
>Sent: Thursday, January 18, 2007 8:13 AM
>To: CF-Newbie
>Subject: Re: Query Question
>
>Ben,
>
>The database at the moment is a simple Access db.  If you can think of 
>any ideas, please feel free to reach me at:  [EMAIL PROTECTED]
>
>John
>>You may need to do some grouping on it - not sure - perhaps quotes?
>>
>>WHERE (PlatMemNew.LastName <> PlatMemOld.LastName) AND 
>>PlatMemOld.RegId







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2444
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to