Ask a Question related to Coldfusion Database Access, Design and Development.
-
bigbrain28 #1
SQL Select causing multiples...
I hate to bother with this, as I have had this issue before and solved it - But
I cannot remember what I did! I have t tables, a member list (with ID) and a
email table (with ID keyed to the member table). I am using the email table as
a boolean to allow emails to those members. If their ID exists in the email
table, its a yes... So in my control panel I have 2 queries, one for the
opt-ins:
<!---Get OPT-INS--->
<cfquery datasource="#DSN#" name="optin">
SELECT distinct
#SESSION.ID.area#members.ID,#SESSION.ID.area#EMAIL .ID,#SESSION.ID.area#members.b
usName
FROM #SESSION.ID.area#members, #SESSION.ID.area#EMAIL
WHERE #session.ID.area#members.ID=#session.ID.area#EMAIL .ID
ORDER BY #SESSION.ID.area#members.busName
</cfquery>
which works fine, and one for OPT-OUTs;
<!---Get OPT-OUTS--->
<cfquery datasource="#DSN#" name="optout">
SELECT DISTINCT
#SESSION.ID.area#members.ID,#SESSION.ID.area#EMAIL .ID,#SESSION.ID.area#members.b
usName
FROM #SESSION.ID.area#members, #SESSION.ID.area#EMAIL
WHERE #SESSION.ID.area#members.ID<>#SESSION.ID.area#EMAI L.ID
ORDER BY #SESSION.ID.area#members.busName
</cfquery>
Which DOES NOT work as planned...
What the OPT-OUT query does is check the email table for a match against EACH
ID, so if I have 10 OPT-IN's in the email table, the OPT-OUT result for EACH
mamber is repeated 10 times. Basically I need the OPT-OUT query to simply show
a list of members who's ID nuber does NOT appear in the email table.
bigbrain28 Guest
-
Multiples adapters with flashcomm
I want to use multiple adapter with different IP address in each one, so I will make sure that one application is working in one IP and another... -
#25474 [Bgs]: posting arrays from a select box with multiple select is not working properly
ID: 25474 User updated by: fmuller at cisco dot com -Summary: apache2filter: posting from a multiple select box is not... -
#25474 [Fbk->Opn]: posting arrays from a select box with multiple select is not working properly
ID: 25474 User updated by: fmuller at cisco dot com Reported By: fmuller at cisco dot com -Status: Feedback... -
set up a datagrid of multiples datatables in 1 dataset
I have a few tables consisting two columns each. They all have the same first column (unique key) What I want to do is show a datagrid, starting... -
SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items mustappear in the select list if SELECT DISTINCT is specified.
Dan, You should be able to do this: SELECT Id, FaxID, ReceivedTime, Pages FROM ( SELECT DISTINCT .Id AS Id, -
mxstu #2
Re: SQL Select causing multiples...
>simply show a list of members who's ID nuber does NOT appear in the email table
One method is to use a subquery
SELECT memberID FROM tableOne WHERE memberID NOT IN (SELECT memberID from
tableTwo)
... or a left join ...
SELECT t1.memberID
FROM tableOne t1 LEFT JOIN tableTwo t2 ON t1.memberID = t2.memberID
WHERE t2.memberID IS NULL
* not tested
mxstu Guest
-
bigbrain28 #3
Re: SQL Select causing multiples...
Awesome! That first method worked perfectly. Thanks so much for the quick response, you are a lifesaver!
bigbrain28 Guest



Reply With Quote

