Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2003
    Posts
    55

    Unanswered: getting count of query??? how?

    hi all

    ive got a problem once again.
    i have a normal select query of the form:

    select x,y,z from abc,def where conditions

    now problem is that before executing the query itself i need to chk the count of the result itll return( that is num of rows that will be returned by my query) and only if the count matches a certain value want to execute it . If anyone knows how i can do ths please help me out with whatever hints/code u can..
    thnx

    -shuchi
    You try and try again..but then give up, there's no sense in being a complete fool about it!!!

  2. #2
    Join Date
    Jan 2003
    Posts
    55

    Red face

    oops ok i managed to get that..duhh used @@rowcount!..lol!
    ok new problem tho..before using value of rowcount i have to specify the query ofcourse but i dont want it displayed.
    any way i can select the relevant rows via a query but not display it as output but the rowcount value shud be updated

    ne ideas..?hope there isnt another function for this!

    -shuchi
    You try and try again..but then give up, there's no sense in being a complete fool about it!!!

  3. #3
    Join Date
    Jul 2001
    Location
    Germany
    Posts
    189

    Question ???

    Hello,

    please, first specify which database and which programs you use.
    Otherwise it is very hard to help

    Best regards

    Manfred Peter
    (Alligator Company GmbH)
    http://www.alligatorsql.com

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yes, you can get a count, but not without executing some query

    instead of

    select x,y,z from abc,def where conditions

    you can run

    select count(*) from abc,def where conditions

    @@rowcount is microsoft sql server, and you'll probably want to ask your question over in that forum -- http://dbforums.com/f7/

    rudy

  5. #5
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Originally posted by r937

    @@rowcount is microsoft sql server, and you'll probably want to ask your question over in that forum -- http://dbforums.com/f7/

    rudy
    Judhing by the number of SQL Server question posted in this forum, I think most people think SQL and SQL Server are synonymous! Trust Bill to manage to make SQL appear to be a Microsoft product!

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    heh, yeah, i'm on (ahem) another forum site as well, where they have a forum called ANSI SQL, and we get sql server questions in there all the time

    but as far as Bill's naming choice is concerned, what about mySQL, PL/SQL, postgreSQL, etc.

    which kind of makes me wonder why this forum is called "SQL and PL/SQL"


    rudy

  7. #7
    Join Date
    Jul 2001
    Location
    Germany
    Posts
    189

    PL/SQL and SQL

    Hello,

    this forum is for general SQL and PL/SQL questions. PL/SQL is a language for creating stored units on an oracle based database.
    like pgsql or mums or TSQL or or or ...

    But, we try to answer every question even those, that are SQLServer based. But we need some little information to answer the question.

    When I remember correctly @@rowcount is also a command in sybase, msql (not mysql) and caché.

    Or it could be a sqlplus command

    If a question is to specific, we move the question to the correct forum ....

    Best regards

    Manfred Peter
    (Alligator Company GmbH)
    http://www.alligatorsql.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •