Good Morning Everyone!
I'm having a mental issue on how i can get the data i need based on a part
number that Iâm retrieving from one table. In the one table i have the top
200 sellers, in my other three tables i have all of the information that goes
with the parts.
I have written three queries that go to each of the three tables.
Question 1:
In all the tables the part number may fit 7 different applications, therefore
the part number can be in there multiple times on my results. I have used the
"DISTINCT" attribute to get the distinct number from the table that hosts the
information. How can i pull all of the corresponding info (Year, Make, Model,
etc) while Iâm using the distinct clause?
Question 2:
If i wanted to get all information from any of the three tables based on a
single part number without duplicates, how would i write that.
I'm not sure is i should be doing joins, or sub-queries, and/or unions.
Here are my 3 queries:
<cfquery name="get_Main_Group_rev" datasource="XXXXXXX" username="XXXXXXX"
password="XXXXXX">
SELECT DISTINCT PartNumber FROM GriffinDataRevised
INNER JOIN Top200 ON GriffinDataRevised.PartNumber = Top200.Part_Number
WHERE Top200.part_number = GriffinDataRevised.PartNumber
</cfquery>
<cfquery name="get_Main_Group_dominator" datasource="XXXXXXX"
username="XXXXXXX" password="XXXXXXX">
SELECT DISTINCT Dominator.part_number FROM Dominator
INNER JOIN Top200 ON Top200.part_number = Dominator.part_number
ORDER BY Dominator.Part_Number ASC
</cfquery>
<cfquery name="get_Main_Group_race" datasource="XXXXXXX" username="XXXXXXX"
password="XXXXXXX">
SELECT DISTINCT PartNumber FROM GriffinRaceDataNew
INNER JOIN Top200 ON GriffinRaceDataNew.PartNumber = Top200.Part_Number
WHERE Top200.part_number = GriffinRaceDataNew.PartNumber
</cfquery>
How can i simplify this process :)
Thank you!
Aaron
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341975
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm