Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2007
    Posts
    24

    Unanswered: Query help needed.

    I have a table with two columns (chemistry_id, cell_line_id) that looks like the following:

    chemistry_id,cell_line_id
    1,2
    1,3
    1,6
    2,2
    2,4
    3,2
    3,7
    4,2
    4,5
    4,6


    I need to query this table for all cell_line_ids that are shared across all chemistry_ids. In the above example, the query would return '2', as it is present for all chemistry_ids. I suspect there is a simple way to do this, but I'm having a hard time coming up with one.

    Any help would be appreciated.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    The final SQL likely includes COUNT(DISTINCT(chemistry_id)) in the WHERE clause
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jan 2007
    Posts
    24
    Yes thank you. I figured that out just a moment ago. I retrieved only the cell_line_ids whose count is equal to count(unique(chemistry_id)).

    Admins, feel free to delete this thread.

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    If all answered questions had been deleted, how would anyone learn anything from them?

Posting Permissions

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