HighDots Forums  

SQL JOIN Problem

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss SQL JOIN Problem in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Red Bull
 
Posts: n/a

Default SQL JOIN Problem - 11-25-2004 , 09:18 AM






Hi, I've created a recordset in DMX but needed to manually edit it as I need
more flexibility, but I am stuck. The following SQL joins 3 tables to give me
a list of Links from the Links table. It only gives the links if they have
transactions present in the Transactions table. I need to do a kind of LEFT
OUTER JOIN but there are three tables and this is MS ACCESS and vbscript. Can
anyone help me reformat this SQL so that I also get records from table Links
even if there are no matching records in Transactions. SELECT
Transactions.LinkID,Links.LinkName,Count(Transacti ons.LinkID) AS NumberLinks,
Min(Transactions.TranDate) AS FromDate, Max(Transactions.TranDate) AS
ToDate,Links.LinkDateAdded, LogTotals.Total FROM Transactions,Links, (SELECT
LinkLogs.LogLinkID, Sum(LinkLogs.LogCost) AS Total FROM LinkLogs Group BY
LinkLogs.LogLinkID) AS LogTotals WHERE Transactions.LinkID=Links.LinkID and
Transactions.LinkID=LinkLogs.LogLinkID AND Transactions.SiteID=1 Group By
Transactions.LinkID,Links.LinkName, LogTotals.Total,Links.LinkDateAdded; Many
thanks


Reply With Quote
  #2  
Old   
twocan's
 
Posts: n/a

Default Re: SQL JOIN Problem - 11-25-2004 , 09:57 AM






Hi yea,
I have had to do complex queries like this a few times before but I used the
Query extension frmo http://www.interaktonline.com , ok it is a commercial
extension but it can save you loads of time.

twocan's




"Red Bull" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
Hi, I've created a recordset in DMX but needed to manually edit it as I
need
more flexibility, but I am stuck. The following SQL joins 3 tables to
give me
a list of Links from the Links table. It only gives the links if they have
transactions present in the Transactions table. I need to do a kind of
LEFT
OUTER JOIN but there are three tables and this is MS ACCESS and vbscript.
Can
anyone help me reformat this SQL so that I also get records from table
Links
even if there are no matching records in Transactions. SELECT
Transactions.LinkID,Links.LinkName,Count(Transacti ons.LinkID) AS
NumberLinks,
Min(Transactions.TranDate) AS FromDate, Max(Transactions.TranDate) AS
ToDate,Links.LinkDateAdded, LogTotals.Total FROM Transactions,Links,
(SELECT
LinkLogs.LogLinkID, Sum(LinkLogs.LogCost) AS Total FROM LinkLogs Group BY
LinkLogs.LogLinkID) AS LogTotals WHERE Transactions.LinkID=Links.LinkID
and
Transactions.LinkID=LinkLogs.LogLinkID AND Transactions.SiteID=1 Group By
Transactions.LinkID,Links.LinkName, LogTotals.Total,Links.LinkDateAdded;
Many
thanks




Reply With Quote
  #3  
Old   
Julian Roberts
 
Posts: n/a

Default Re: SQL JOIN Problem - 11-25-2004 , 11:33 AM



Plug the SQL into an Access query and then use the visual tools to alter the
properties of the join.

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.