Trigger to update and inser a count in column

  • I need a record order by the count descending but it is not taking order by desc count column

    What should i do??

    Thanks & Regards,
    Pallavi

  • pallavi.unde (12/13/2011)


    I need a record order by the count descending but it is not taking order by desc count column

    What should i do??

    Why do you want ORDER BY in view at first place? You can query a view with ORDER BY.

    SELECT *

    FROM trialbase -- Your View

    ORDER BY becount desc

  • Bcount is not a column in any table... that is the column made by count() function where i used alias aa bcount.

    and bcount is going to update at every time.

    Thanks & Regards,
    Pallavi

  • pallavi.unde (12/13/2011)


    Bcount is not a column in any table... that is the column made by count() function where i used alias aa bcount.

    and bcount is going to update at every time.

    Agree. But you can query on view and there it would be consider as regular column. Please check my last post again.

  • As Dev suggests, ditch the ORDER BY. The only thing that will guarantee sorted results is if you use an ORDER BY when you call the view, so leave it out of the view definition. If you must use it, you can't refer to a column alias - you have to put the whole aggregate statement in again.

    John

  • Yes It's working

    I used

    SELECT * FROM

    view order by becount desc

    It proved need not to use trigger.. 🙂

    Thanks & Regards,
    Pallavi

Viewing 6 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic. Login to reply