Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL for <CFMAIL>

Status
Not open for further replies.

metaphiz

Programmer
Jun 30, 2004
91
US
I'm using <cfmail> to send a bulk email to all users in the Users table. It's an HTML email which has to be populated with property data from the SaleProps table. I only want 2 properties to go to all of the users. The SQL below is sending one property per email to every user. But it is sending each property in a separate email, so each user gets as many emails as there are properties! PLEASE HELP!

<cfquery name="GetMailingUser" datasource="#MainDS#">
SELECT Email,PropertyTitle,PinNo,Direction,PropDescription,MapLink,DateUpdated,DateCreated,PropImgs
FROM Users, SaleProps
WHERE 0=0
</cfquery>
 
Naturally. This is a Cartesian join:

SELECT Email,PropertyTitle,PinNo,Direction,PropDescription,MapLink,DateUpdated,DateCreated,PropImgs
FROM Users, SaleProps


You get one record from table b for every record in table a, for every record of table a.

There must be a relationship between these two tables for this query to make sense. Plus, how do you determine which two properties you want to send?

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Pity the insomniac dyslexic agnostic. He stays up all night, wondering if there really is a dog.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top