Re: {NJ} Query problem !
Posted in 1999
Hi ! Thanks a lot for ur help...It worked ! It really worked ! But earlier the problem was tht if u have too much data it crawls and i was thinking tht there is a problem in the query itself. May be it is this tht our database is very slow. Thanks a million for help...it saved me (-; Nayan ! > > > > > Let's see what we can do. > > > First of all - I've tested it on a table with 3139 rows. It works fast. > > > But - I have an index on 'first' field. And after creating index I would > > > run an update statistics on this table. > > > > > > As of the second question - sorry I didn't understand you very well. > > > So, you want to get the rows ordered by the count of first field. > > > It is much simple: > > > > > > select (select count(*) > > > from tab1 b > > > where b.field1 = a.field1), > > > a.* > > > from tab1 a > > > order by 1 > > > > > > Best Regards, > > > Octav > > > > > > > > > NAYAN JAIN wrote: > > > > > > > > Hi again ! > > > > > > > > Sorry but i m sending this mail to u only. > > > > > > > > Thanks for ur answer...but your query seems to be a bit complex. > > > > > > > > For my table with 3359 records it is running for last 25 minutes. > > > > ?????? > > > > > > > > Wht to do ? > > > > > > > > Should i send u my table / data so tht u can guide me well ? > > > > > > > > Also if i m not clear... > > > > > > > > I want to display all the 3359 records from the table but all the > > > > records where field 1 count(*) is maximum are to be displayed first. > > > > > > > > Like in my example... > > > > A first (all records having field 1 as A) > > > > B second > > > > C third > > > > > > > > ???? > > > > > > > > Please reply asap > > > > > > > > TIA, > > > > Nayan !