Current ID?

Results 1 to 2 of 2

Thread: Current ID?

  1. #1
    Join Date
    Dec 1969

    Default Current ID?

    Hi. I am using Oracle and PL/SQL. I am doing a SELECT statement but also want to add a pseudo column called COUNT where I am counting the number of records for the "current" ID. This SQL statement works:<BR><BR>SELECT FunctionID, FunctionName, (SELECT COUNT(*) AS COUNT FROM <BR>(SELECT FUNCTIONID FROM FUNCTION START WITH FunctionID = 8<BR>CONNECT BY PRIOR FUNCTIONID = FUNCTIONPARENTID ) Function) FROM Function WHERE FunctionParentID IS NULL<BR><BR>This pulls all of my parent functions. But it inserts the same number in the Count column because I have hard-coded the number 8. Is there a way where I can have the FunctionID equal to the current FunctionID so that the Count column holds valid information? Thanks!<BR>

  2. #2
    Join Date
    Dec 1969

    Default I think you are working way too hard???

    What is wrong with simply<BR><BR>SELECT FunctionID, FunctionName, COUNT(*) As IDCount<BR>FROM Function<BR>WHERE FunctionParentID IS NULL<BR>GROUP BY FunctionID, FunctionName<BR>ORDER BY FunctionName<BR><BR>???<BR><BR>Am I missing something BIG?<BR><BR><BR>

Posting Permissions

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