Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    12

    Post Unanswered: Issue with a Query

    Hello,

    I have a query which runs in the Production DB and not in Development. I won't mind if it does nto return data but it says"Missing expression". I am quiet confused with this. This query was written by some one else and I do not understand the way it is written. - It contains a count(*) as a inside query,

    The query is:
    select g.GENERIC_NAMEID, g.GENERIC_NAME, g.GENERIC_LABEL, tc.TAGCATID, tc.TAGCATEGORY, a.APPLICATION from GENERIC_NAME g, TAGCATEGORY tc, APPLICATION a WHERE tc.NOT_VISIBLE <> '1' and tc.TAGCATID is not NULL and tc.APPLICATIONID = a.APPLICATIONID and g.TAGCATID = tc.TAGCATID and (select count(*) from tasks where writeback_flag = 'Y' and tasks.generic_name_id = g.generic_nameid) > 0 order by tc.SORTORDER, g.GENERIC_NAME

    Would really appreciate if any one could throw light on this.

    Thanks,
    dessri

  2. #2
    Join Date
    Feb 2004
    Posts
    108
    Confirm that the column names are correctly spelled in the query. Verify that g.GENERIC_NAME, g.GENERIC_LABEL, tc.TAGCATID, tc.TAGCATEGORY, A.APPLICATION, etc all exists in respective tables.

    Replace
    AND (SELECT COUNT(*) FROM Tasks WHERE writeback_flag = 'Y' AND Tasks.generic_name_id = g.generic_nameid) > 0

    With :
    AND EXISTS ( SELECT 1 FROM Tasks WHERE writeback_flag = 'Y' AND Tasks.generic_name_id = g.generic_nameid )

  3. #3
    Join Date
    Feb 2004
    Posts
    12

    Smile

    Hi pinakdb,

    Yes the second option (and EXISTS ( SELECT 1 FROM Tasks WHERE writeback_flag = 'Y' AND Tasks.generic_name_id = g.generic_nameid ) ) works.....

    THANKS A LOT,

    dessri

Posting Permissions

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