G
Guest
Hello,
I have an sql statement problem that I hope one of you could help me with.
For a little backgorund info, I have two tables in my SQL Server 2000
database. One table has distinct part numbers and descriptions. The other
table has many rows of the same part numbers and additional information like
version number. So between the two tables it is a many to one relationship.
Look at the example below.
Table One:
(Part Number Column) (Description Column)
1234 Widget One
1235 Widget Two
1236 Widget Three
1237 Widget Four
Table Two:
(PartNumber Column) (Additional Info Column)
1234 Version One
1234 Version Two
1234 Version Three
1235 Version One
1236 Version One
1236 Version Two
1237 Version One
The above example was completely hypothetical.
Here is my solution to getting returned results back into one table
Here is the sql statement that I have:
SELECT DISTINCT productCatalog.productID, productCatalog.brandID,
productCatalog.partNumber, productCatalog.price, productCatalog.type,
productCatalog.imageURL, productCatalog.modifier, productCatalog.category,
Product_Applications.vehicleMake, Product_Applications.vehicleModel,
Product_Applications.vehicleYear, productCatalog.description FROM
dbo.productCatalog, dbo.Product_Applications WHERE productCatalog.partNumber
= Product_Applications.partNumber
When I run the above query I end up with duplicate partNumbers in my
returned results. What I want are distinct part numbers based on the
different application types. I am using these results to filter the
results. So if someone selects a specific year and a specific type and a
specific make the results would be based on that filter. This data is all I
have to work with. Any suggestions?
Thanks,
J
I have an sql statement problem that I hope one of you could help me with.
For a little backgorund info, I have two tables in my SQL Server 2000
database. One table has distinct part numbers and descriptions. The other
table has many rows of the same part numbers and additional information like
version number. So between the two tables it is a many to one relationship.
Look at the example below.
Table One:
(Part Number Column) (Description Column)
1234 Widget One
1235 Widget Two
1236 Widget Three
1237 Widget Four
Table Two:
(PartNumber Column) (Additional Info Column)
1234 Version One
1234 Version Two
1234 Version Three
1235 Version One
1236 Version One
1236 Version Two
1237 Version One
The above example was completely hypothetical.
Here is my solution to getting returned results back into one table
Here is the sql statement that I have:
SELECT DISTINCT productCatalog.productID, productCatalog.brandID,
productCatalog.partNumber, productCatalog.price, productCatalog.type,
productCatalog.imageURL, productCatalog.modifier, productCatalog.category,
Product_Applications.vehicleMake, Product_Applications.vehicleModel,
Product_Applications.vehicleYear, productCatalog.description FROM
dbo.productCatalog, dbo.Product_Applications WHERE productCatalog.partNumber
= Product_Applications.partNumber
When I run the above query I end up with duplicate partNumbers in my
returned results. What I want are distinct part numbers based on the
different application types. I am using these results to filter the
results. So if someone selects a specific year and a specific type and a
specific make the results would be based on that filter. This data is all I
have to work with. Any suggestions?
Thanks,
J