Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!tut.cis.ohio-state.edu!bear.cis.ohio-state.edu!doug From: doug@bear.cis.ohio-state.edu (Doug Kerr) Newsgroups: comp.databases Subject: SQL question Message-ID: <75547@tut.cis.ohio-state.edu> Date: 11 Jan 90 16:01:51 GMT Sender: news@tut.cis.ohio-state.edu Reply-To: Doug Kerr Organization: Ohio State University Computer and Information Science Lines: 27 I'm trying to write a single SELECT statement that involves a complex sort order and have had no success. The problem is given a relation R(A,B,C,D) sort as follows: all tuples with A > A1, sorted by A all tuples with A <= A1 and B > B1, sorted by B all other tuples (A <= A1 & B <= B1), sorted by C I can write seperate SELECTS for each subset, but is there a way to combine the three sets into one? I need this ordering because I need to make assignments in an embeded SQL program corresponding to the D values based on the ranking given by this sort order, i.e. I may assign one value to the first 10 D's, another value to the next 20 values, etc. There is no relationship between 10, 20, etc. and the breaks in the three groups. The program will be much easier to write if I need one cursor rather than 3. Thanks for any help you can provide. -=- Douglas S. Kerr, Department of Computer and Information Science The Ohio State University; 2036 Neil Ave. Columbus OH USA 43210-1277 doug@cis.ohio-state.edu 614/292-1519 ...!{pyramid,killer}!osu-cis!cis.ohio-state.edu!doug