On 2/7/08, jose isaias cabrera <[EMAIL PROTECTED]> wrote:
>
> "P Kishor" asked...
>
>
> >I don't understand your question at all.
>
> I will answer it at the end.
>
> > On 2/7/08, jose isaias cabrera <[EMAIL PROTECTED]> wrote:
> >>
> >> Greetings.
> >>
> >> I would like to have the results of a select be returned sorted in an
> >> specific way.  Let me show you what I mean:
> >>
> >> sqlite> SELECT PSubClass FROM LSOpenJobs WHERE subProjID = 2190 GROUP BY
> >
> > But, first... why are you using GROUP BY above when you have no
> > aggregate function (Count, Max, Min, Sum, etc.) in your query?
>
> Because of this:
>
> sqlite> SELECT PSubClass FROM LSOpenJobs WHERE subProjID = 2190;
> Pre-Proc
> Post-Proc
> DOC-Trans
> DTP
> Pre-Proc
> Pre-Proc
> Pre-Proc
> Pre-Proc
> Pre-Proc
> Post-Proc
> Post-Proc
> Post-Proc
> Post-Proc
> Post-Proc
> DOC-Trans
> DOC-Trans
> DOC-Trans
> DOC-Trans
> DOC-Trans
> DTP
> DTP
> DTP
> DTP
> DTP
> PM
> PM
> PM
> PM
> PM
> PM
> sqlite>

In that case you need SELECT DISTINCT, not GROUP BY


>
>
> >
> >> PSubClass;
> >> DOC-Trans
> >> DTP
> >> PM
> >> Post-Proc
> >> Pre-Proc
> >> sqlite>
> >>
> >> What I would like is to have the SELECT result be,
> >>
> >> Pre-Proc
> >> Post-Proc
> >> DOC-Trans
> >> DTP
> >> PM
> >>
> >> is this possible?  Yes, I know I can sort it in the program, but how can
> >> I
> >> get this special sort from the DB?
> >>
> >
> > What is the logic above? Without you telling us why Pre-Doc is before
> > Post-Proc is before DOC-Trans, and so on, how can we guess what your
> > logic is for the sort? In other words, please explain what makes the
> > above sort "special"?
>
> Aaah, ok.  I am preparing an html file and in it I will list these
> PSubClasses in this special logical display sequence:
> 1. Pre-Proc
> 2. Post-Proc
> 3. DOC-Trans
> 4. DTP
> 5. PM
>
> I hope this explains it...
>

Nope, it doesn't at all. You logic is not clear to me, and even if it
is, it won't be clear to the poor program that you want to write. If
you want a specific order which is not dependent on a collation
sequence, alpha order, etc., then enter your prescribed ordinal-ity in
a separate column and ORDER BY that column.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to