...

View Full Version : Duplicate entries



crono.Serge
07-12-2007, 04:03 PM
Hi Guys,

I was wondering if there's anything wrong with this code:


<cfquery datasource="SSHInven" name="vAll">
SELECT
a.pType, a.sOnHand, a.DateModified,
b.wQuantity,
c.mcQuantity
FROM iParts a, iWSpares b, iMSpares c
</cfquery>

I want to be able to select those particular fields from my DB, but, when I <cfoutput> it keeps repeating all seven items I have in the iParts table (I'm testing with that first to see what's going on). The <cfoutput> tag I have looks like:



<cfoutput query="vAll">
#pType# | #sOnHand# <br />
</cfoutput>

And, like I said before, it just keeps repeating that same info about 7 times. Any particular reason why???

Thanks in advance!!

athanasiusrc
08-08-2007, 12:07 AM
You need to make sure that your tables are properly joined in the query.

Something like:
SELECT
a.pType, a.sOnHand, a.DateModified,
b.wQuantity,
c.mcQuantity
FROM iParts a
join
iWSpares b
on
a.primary_key = b.foreignkey
join
iMSpares c
on
a.primary_key = c.foreignkey



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum