If there can be multiple values for the subqueries, what to you want the resultset to look like?
To simplify, say there was just a glaze (shiny, matte) and a colour (blue, green) for pottery ID 27. Do you want: ID, glaze colour 27, shiny, blue 27, shiny, green 27, matte, blue 27, matte, green returned? On 12/14/05, John Wilker <[EMAIL PROTECTED]> wrote: > Oops sorry, I wasn't clear. Yes the sub queries can return multiple values, > which is ok with me (not with the SQL) I need to handle getting more than > one value some times, but not all the time. > > J > > On 12/13/05, ColdFusion <[EMAIL PROTECTED]> wrote: > > > > Basically one of the subqueries are returning more than one value > > I would check the subqueries to make sure they one return one value, > > And if it does return more than one value (as a true request), then you > > Can not use x = y where Y is more than one item. > > It has to be re-written to be like: > > > > (X = Y OR X = Z) > > > > Not sure if that would make sense.. Too much in my head right now. > > > > > > -----Original Message----- > > From: John Wilker [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, December 13, 2005 7:06 PM > > To: CF-Talk > > Subject: more of my SQL issues :) > > > > I'm working on another large search, different project. > > > > I had columns with lists, I've since moved them to a look up table. Here's > > my query and the error I get. > > > > SELECT P.id, > > P.Number, > > P.TheYear, > > P.Price, > > P.ShortDesc, > > P.LongDesc, > > P.Status, > > P.width, > > P.height, > > P.Weight, > > (Select Type FROM TypeLookup WHERE PotteryIDFK = 27 AND TypeIDFK = 1) AS > > Category, (Select Type FROM TypeLookup WHERE PotteryIDFK = 27 AND TypeIDFK > > = > > 3) AS ClayBody, (Select Type FROM TypeLookup WHERE PotteryIDFK = 27 AND > > TypeIDFK = 5) AS glaze, (Select Type FROM TypeLookup WHERE PotteryIDFK = > > 27 > > AND TypeIDFK = 2) AS fireKind, (Select Type FROM TypeLookup WHERE > > PotteryIDFK = 27 AND TypeIDFK = 4) AS color, P.price, P.Owner FROM Pottery > > P > > LEFT JOIN PotteryPictures PP ON P.ID = PP.PotteryID WHERE p.id = 27 > > > > > > Error: Server: Msg 512, Level 16, State 1, Line 1 Subquery returned more > > than 1 value. This is not permitted when the subquery follows =, !=, <, <= > > , > > >, >= or when the subquery is used as an expression. > > > > I know enough SQL to get by but I've met my match with nested queries and > > such. > > > > Thanks > > > > -- > > John Wilker > > Writer/Web Consultant > > www.johnwilker.com / www.red-omega.com > > > > "The measure of success is not whether you have a tough problem to deal > > with, but whether it's the same problem you had last year." > > ~John Foster Dulles, Former US Sec. of State. > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226981 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

