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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DISTINCT trouble

Status
Not open for further replies.

PhatH

IS-IT--Management
Mar 30, 2004
88
US
I want to display only 1 output for the same data name onto a screen. EX: To find and display ProdTypeName once on screen while selecting ProductID and ManuID as well from a couple certain combo tables.

by using sql2000,

sql = "SELECT DISTINCT tblProductType.ProdTypeName, tblProducts.ProductID, tblProducts.ManuID FROM tblProducts, tblProductType WHERE tblProducts.ProdTypeID = tblProductType.ProdTypeID and tblProducts.ManuID = '" & request.querystring("ManuID") & "'"

Could you tell me why the DISTINCT tblProductType.ProdTypeName is not working?
 
Do you mean you only want one random record returned for each ProdTypeName?
If so, you could try:
[tt]
SELECT t.ProdTypeName,p.ProductID,p.ManuID
FROM
tblProducts p JOIN tblProductType t USING (ProdTypeID)
WHERE p.ManuID = 'whatever'
GROUP BY t.ProdTypeName
[/tt]

Note that this is MySQL-specific syntax (this is a MySQL forum!), as somebody else will be quick to point out if I don't.

-----
ALTER world DROP injustice, ADD peace;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top