counting


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: counting

  1. #1
    fredrisv Guest

    counting


    Hi

    can anyone help me create a statement that produces a table like this


    FNR(key) #times_in_table
    --- ---------------
    1 11
    4 7
    3 4
    2 1

    thanx fredrik

  2. #2
    fredrisv Guest

    Re: counting


    I found a sollution:

    select DISTINCT u.fnr, f.title,
    (select count(u.fnr)
    from fredrisv.utleie u
    where u.fnr=f.fnr) as timesrented
    from fredrisv.film f, fredrisv.utleie u
    where f.fnr=u.fnr
    order by timesrented DESC, title ASC";


    Please let me know if you have other suggestions,

    Fredrik




    "fredrisv" <fredrisv@ifi.uio.no> wrote:
    >
    >Hi
    >
    >can anyone help me create a statement that produces a table like this
    >
    >
    >FNR(key) #times_in_table
    >--- ---------------
    >1 11
    >4 7
    >3 4
    >2 1
    >
    >thanx fredrik



  3. #3
    mark erickson Guest

    Re: counting


    Try:

    select FNR,count(*) from myTable group by FNR order by count(*) desc






    "fredrisv" <fredrisv@ifi.uio.no> wrote:
    >
    >Hi
    >
    >can anyone help me create a statement that produces a table like this
    >
    >
    >FNR(key) #times_in_table
    >--- ---------------
    >1 11
    >4 7
    >3 4
    >2 1
    >
    >thanx fredrik



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center