Results 1 to 14 of 14
  1. #1
    Join Date
    Nov 2003
    Location
    Dhaka,Bangladesh
    Posts
    86

    Unanswered: Crying with my Query

    I have 2 table

    Table1: Subject
    ----------
    A
    B
    C

    Table2: Entry
    -------
    Id Sub_name
    --- -----------
    1 A
    1 B
    1 C
    2 A
    2 B
    3 B
    3 C

    Now i want a query to view "Show the student Id who took all the sub_name from table1" In this case the ourout will be Like

    Id
    ---
    1

    Please Help anyone Its realy a urgent mattar ...........
    hello

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    You could use COUNT(DISTINCT subject) grouped by student, and compare with the COUNT of subjects.

  3. #3
    Join Date
    Nov 2003
    Location
    Dhaka,Bangladesh
    Posts
    86

    Thanks but Please send me an example

    andrewst

    Thanks a lot.can u please Post an example on my 2 tables? Please It a realy need for me.
    hello

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    I don't like to provide answers to homework questions. You need to use the GROUP BY and HAVING clauses, and a subquery to compare with in the HAVING clause.

    Post your best attempt and we can take it from there!

  5. #5
    Join Date
    Nov 2003
    Location
    Dhaka,Bangladesh
    Posts
    86

    Unhappy I am confused

    Dear andrewst

    I am realy confused with your replies. Please know that I am a new babe in Oracle. Is this the way to help a new Person in Forum??. I am realy confused. I want a example thats all...If u dont feel for me then no problem Its ok. Thanks For ur Previous Support.
    hello

  6. #6
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Mahfuz,

    post a query YOU wrote to solve this problem. It won't work properly, but never mind that ... we'll improve it somehow.

    The point is that Tony won't write your homework. He'll help you, be sure in that, but first you have to show that you tried it by yourself.

    Moreover, his posts almost wrote a query you need ... just translate his sentences into a SQL language (which is alike speaking English) and you'll have it done. Try it ... Tony really put here all you need: GROUP BY, HAVING, COUNT(DISTINCT subject) compare to another COUNT(all subjects). There are only a 3-4 lines to write. I'm sure you can do it if you really try.

  7. #7
    Join Date
    Nov 2003
    Location
    Dhaka,Bangladesh
    Posts
    86

    Nothing To say

    Thanks Littlefoot ,

    I already said i m a new person in Oracle. Simply I request for a example in friendly attitude but all u r acting like my teachers. Its ok
    If u dont give any example...Ya may be I will face some complex but its
    ok...and my all thanks goes to u all Broad minded Oracle Experts.
    hello

  8. #8
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    I am sorry you are unhappy with our responses, but it is a general philosophy in forums like this that we help people to do the work themselves, rather than just spoon-feeding entire solutions. It would be unethical really for us to do your homework for you so that you can get top marks from your teacher while still understanding absolutely nothing about the subject. And at the end of the day, it wouldn't help you, because next time you have a problem to solve you still won't know how to do it. And when the final exam comes, we won't be there to help, and you will fail big time!

    Broad minded we may be. Soft in the head, no!

  9. #9
    Join Date
    Nov 2003
    Location
    Dhaka,Bangladesh
    Posts
    86

    Please Know IT

    Dear andrewst

    Thnaks For ur Response. Please Know that i am not a student. I am a computer enginee but Agian i am Telling u i m a new stuff in Oracle ....
    You can also chq my site "www.froghead.envy.nu" I got enough support from Dbforums. So i hope this time i might get again. I am just Feeling
    complex for this little query for a part of my software. Ok It totaly Depends
    on u that u give a solution or not. Thanks anyway.

    mahfuz
    BSC(Engr.) IN Computer Science & Engineering (CSE)
    hello

  10. #10
    Join Date
    Apr 2003
    Location
    Minneapolis, MN
    Posts
    273
    Hi Mahfuz,

    I can give you further hint for this query which helps you solve it by your own.

    This is a DEVIDE query if you have heard about during your BSC (Computers).
    Bhavin

    MS Computer Science
    OCP DBA 9i/8i

  11. #11
    Join Date
    Jan 2003
    Location
    China
    Posts
    38
    If a student don't have other subjects like D,E,F...
    You can try this:

    SELECT ID FROM Entry GROUP BY Id HAVING COUNT(DISTINCT Sub_name) = SELECT COUNT(*) FROM Subject
    Last edited by 884813; 05-30-04 at 05:46.

  12. #12
    Join Date
    Nov 2003
    Location
    Dhaka,Bangladesh
    Posts
    86

    I am greatfull

    Dear 884813

    Thnaks a lot. I beleive some people still in this crutial world who wants to help without bla bla bla by making noise by their mouth and you realy helped me. Thanks a lot 884813 I am realy greatfull to you. Thnaks.

    mahfuz
    hello

  13. #13
    Join Date
    Jan 2003
    Location
    China
    Posts
    38

    Tony is right

    Mahfuz

    You should know the meanings of these keywords:group by,having,distinct...
    then you can solve a lot of problems like this you posted here.

    By the way,I can't access the website 'www.froghead.envy.nu' you gave us.
    Fan Yi

  14. #14
    Join Date
    Nov 2003
    Location
    Dhaka,Bangladesh
    Posts
    86

    Ples Try my URL i think it is correct

    Dear 884813
    Thanks For Replying me again. Ok I will more carefulll about my quireis next time and i will do more hardwork. Please chq my Web again i think it is correct: http://www.froghead.envy.nu/

    greatfull mahfuz
    hello

Posting Permissions

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