Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL help needed

SQL help needed

Scheduled Pinned Locked Moved Database
databasehelptutorial
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jegastar
    wrote on last edited by
    #1

    Hi All, I have 2 tables Table name: Property_Master Pm_id | Remarks 1 | Good 2 | Bad 3 | fair Table Name: Property_Details PD_id | Pd_Pm_Id | Price 1 | 1 | 2000 2 | 1 | 2100 3 | 2 | 5000 4 | 2 | 5500 5 | 3 | 2500 I want following result PM_Id | Pd_Pm_Id | Price | Remarks 1 | 1 | 2000 | Good 2 | 2 | 5000 | Bad 3 | 3 | 2500 | Fair How to write SQL query for it. How it is possible. Please help me. Jegastar

    P I 2 Replies Last reply
    0
    • J jegastar

      Hi All, I have 2 tables Table name: Property_Master Pm_id | Remarks 1 | Good 2 | Bad 3 | fair Table Name: Property_Details PD_id | Pd_Pm_Id | Price 1 | 1 | 2000 2 | 1 | 2100 3 | 2 | 5000 4 | 2 | 5500 5 | 3 | 2500 I want following result PM_Id | Pd_Pm_Id | Price | Remarks 1 | 1 | 2000 | Good 2 | 2 | 5000 | Bad 3 | 3 | 2500 | Fair How to write SQL query for it. How it is possible. Please help me. Jegastar

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      See the answers that we gave to you yesterday. It looks like you need to use a join. BTW - this also looks suspiciously like homework, so don't expect people on this site to do it for you.

      Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world." Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that." Deja View - the feeling that you've seen this post before.

      J 1 Reply Last reply
      0
      • P Pete OHanlon

        See the answers that we gave to you yesterday. It looks like you need to use a join. BTW - this also looks suspiciously like homework, so don't expect people on this site to do it for you.

        Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world." Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that." Deja View - the feeling that you've seen this post before.

        J Offline
        J Offline
        jegastar
        wrote on last edited by
        #3

        I am sorry. But just say whether it is possible or not. Jegastar

        P 1 Reply Last reply
        0
        • J jegastar

          I am sorry. But just say whether it is possible or not. Jegastar

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          I already gave you a hint. If you've got two tables and you need the results out of both, use a JOIN. Google it.

          Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world." Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that." Deja View - the feeling that you've seen this post before.

          D 1 Reply Last reply
          0
          • J jegastar

            Hi All, I have 2 tables Table name: Property_Master Pm_id | Remarks 1 | Good 2 | Bad 3 | fair Table Name: Property_Details PD_id | Pd_Pm_Id | Price 1 | 1 | 2000 2 | 1 | 2100 3 | 2 | 5000 4 | 2 | 5500 5 | 3 | 2500 I want following result PM_Id | Pd_Pm_Id | Price | Remarks 1 | 1 | 2000 | Good 2 | 2 | 5000 | Bad 3 | 3 | 2500 | Fair How to write SQL query for it. How it is possible. Please help me. Jegastar

            I Offline
            I Offline
            InsDev
            wrote on last edited by
            #5

            select p.pid,pd.pid_pm,min(pd.price),p.remarks from p,pd where p.pid *=pd.pid_pm group by pd.pid_pm,p.remarks,p.pid i hope so this solve your problem

            1 Reply Last reply
            0
            • P Pete OHanlon

              I already gave you a hint. If you've got two tables and you need the results out of both, use a JOIN. Google it.

              Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world." Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that." Deja View - the feeling that you've seen this post before.

              D Offline
              D Offline
              Dayekh
              wrote on last edited by
              #6

              I realise that you are trying to help mate, but if you have the time to give him a hint, you also have the time to explain to him what a Join is. You don't have to give him the answer, but your attitude should be more like a supportive teacher than a guy who tells people to 'Google it' and leave you alone. If everyone simply googles everything, then there is no need for this website is there? Your hints are appreciated and helpful, especially when I get them, but for all newbies including myself, it's the attitude that bites. Don't take this the wrong way. I would like to see positive and supportive attitude on forums like this as I'm am sure many people would. EDIT: Don't make sweeping statements that people on this site "won't do his homework for him" because regardless of whether it is homework, we all need help with our work. It's what this site is for.. go figure..

              P 1 Reply Last reply
              0
              • D Dayekh

                I realise that you are trying to help mate, but if you have the time to give him a hint, you also have the time to explain to him what a Join is. You don't have to give him the answer, but your attitude should be more like a supportive teacher than a guy who tells people to 'Google it' and leave you alone. If everyone simply googles everything, then there is no need for this website is there? Your hints are appreciated and helpful, especially when I get them, but for all newbies including myself, it's the attitude that bites. Don't take this the wrong way. I would like to see positive and supportive attitude on forums like this as I'm am sure many people would. EDIT: Don't make sweeping statements that people on this site "won't do his homework for him" because regardless of whether it is homework, we all need help with our work. It's what this site is for.. go figure..

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #7

                Thanks for the insight, especially as I spend a lot of my time answering questions for people. However, you will find that there are a lot of times when it looks as though people want you to do their homework for them, and the best thing that you can do for them is to give them a hint and see how they go from their. I spend a large amount of my time helping people here, giving something back to the CP community.

                Dayekh wrote:

                EDIT: Don't make sweeping statements that people on this site "won't do his homework for him" because regardless of whether it is homework, we all need help with our work. It's what this site is for.. go figure..

                Errm actually, the site isn't for homework (and you will find that a lot of people on this site will answer you in precisely the same way that I did - not a sweeping statement, but the fact that I have used this site for a long time). I don't think that teachers would appreciate us doing the homework for somebody. That doesn't help them - and I speak as somebody who used to be a teacher. Give them a hint certainly, point them in the general direction, but don't give them the answer. If you do this, then you sell them short because they have not answered things for themselves - and missed the sense of achievement that they will get from this.

                Dayekh wrote:

                If everyone simply googles everything, then there is no need for this website is there? Your hints are appreciated and helpful, especially when I get them, but for all newbies including myself, it's the attitude that bites. Don't take this the wrong way. I would like to see positive and supportive attitude on forums like this as I'm am sure many people would.

                As soon as somebody says something like this, I automatically take it the wrong way. If I didn't want to be bothered, I wouldn't have answered the post. What I do want is for you to learn something when I answer, and that means that I will often give you hints to point you in the right direction. That way, you learn something on your own and it sticks. If I give you the answer then you don't learn anything. You won't remember it. If you don't like my attitude, then mate, that is your problem and not mine. I'm not going to change the way that I answer just for you. If I can help, I will. If I think that you need a specific answer, I will give you one. If I think that you can undertake a personal journey and learn something on your own, I w

                D 1 Reply Last reply
                0
                • P Pete OHanlon

                  Thanks for the insight, especially as I spend a lot of my time answering questions for people. However, you will find that there are a lot of times when it looks as though people want you to do their homework for them, and the best thing that you can do for them is to give them a hint and see how they go from their. I spend a large amount of my time helping people here, giving something back to the CP community.

                  Dayekh wrote:

                  EDIT: Don't make sweeping statements that people on this site "won't do his homework for him" because regardless of whether it is homework, we all need help with our work. It's what this site is for.. go figure..

                  Errm actually, the site isn't for homework (and you will find that a lot of people on this site will answer you in precisely the same way that I did - not a sweeping statement, but the fact that I have used this site for a long time). I don't think that teachers would appreciate us doing the homework for somebody. That doesn't help them - and I speak as somebody who used to be a teacher. Give them a hint certainly, point them in the general direction, but don't give them the answer. If you do this, then you sell them short because they have not answered things for themselves - and missed the sense of achievement that they will get from this.

                  Dayekh wrote:

                  If everyone simply googles everything, then there is no need for this website is there? Your hints are appreciated and helpful, especially when I get them, but for all newbies including myself, it's the attitude that bites. Don't take this the wrong way. I would like to see positive and supportive attitude on forums like this as I'm am sure many people would.

                  As soon as somebody says something like this, I automatically take it the wrong way. If I didn't want to be bothered, I wouldn't have answered the post. What I do want is for you to learn something when I answer, and that means that I will often give you hints to point you in the right direction. That way, you learn something on your own and it sticks. If I give you the answer then you don't learn anything. You won't remember it. If you don't like my attitude, then mate, that is your problem and not mine. I'm not going to change the way that I answer just for you. If I can help, I will. If I think that you need a specific answer, I will give you one. If I think that you can undertake a personal journey and learn something on your own, I w

                  D Offline
                  D Offline
                  Dayekh
                  wrote on last edited by
                  #8

                  I am very happy with your reply mate. :-D You have replied in a very intellectual manner and did not flame me. People with such responses are ones who deserve posting on this site. :cool:

                  Pete O`Hanlon wrote:

                  if you had followed the threads of my conversation with this guy, you would see that I had attempted to help him before.

                  I do not know much about this guy, but something about your second response what like you were attempting to shoo him off. That was the statement I didn't like.

                  Pete O`Hanlon wrote:

                  Errm actually, the site isn't for homework (and you will find that a lot of people on this site will answer you in precisely the same way that I did - not a sweeping statement, but the fact that I have used this site for a long time). I don't think that teachers would appreciate us doing the homework for somebody. That doesn't help them - and I speak as somebody who used to be a teacher. Give them a hint certainly, point them in the general direction, but don't give them the answer. If you do this, then you sell them short because they have not answered things for themselves - and missed the sense of achievement that they will get from this.

                  About the Homework factor.. I cannot completely agree with you, simply because work is work at the end of the day. It is the response which counts. As I have said in my post, you don't need to give them the answers. I was only talking about the attitude. It was not hostile, but distant. That's all. :| When you tell someone to google something, just explain to him why you are not giving the answer. Many people do not know that the best way to learn is to 'teach him how to fish' so to speak. They will just assume that you are unhelpful, which is not the case. :doh: In anycase, I suppose everyone helps in their own way. What can I say. And indeed the best way to help is to 'teach a man to fish' as they say.

                  Pete O`Hanlon wrote:

                  Thanks for the insight, especially as I spend a lot of my time answering questions for people.

                  Every member of this site is a contribution, whether they ask questions or reply to them. We all supply this large FAQ with puzzles and solutions.. somewhat. And for that, they are a credit to such a community. And for that, I hope none of this ramble has affected the professional relationship between coders such as yourself and I. Take care, and be gentle ;P

                  P 1 Reply Last reply
                  0
                  • D Dayekh

                    I am very happy with your reply mate. :-D You have replied in a very intellectual manner and did not flame me. People with such responses are ones who deserve posting on this site. :cool:

                    Pete O`Hanlon wrote:

                    if you had followed the threads of my conversation with this guy, you would see that I had attempted to help him before.

                    I do not know much about this guy, but something about your second response what like you were attempting to shoo him off. That was the statement I didn't like.

                    Pete O`Hanlon wrote:

                    Errm actually, the site isn't for homework (and you will find that a lot of people on this site will answer you in precisely the same way that I did - not a sweeping statement, but the fact that I have used this site for a long time). I don't think that teachers would appreciate us doing the homework for somebody. That doesn't help them - and I speak as somebody who used to be a teacher. Give them a hint certainly, point them in the general direction, but don't give them the answer. If you do this, then you sell them short because they have not answered things for themselves - and missed the sense of achievement that they will get from this.

                    About the Homework factor.. I cannot completely agree with you, simply because work is work at the end of the day. It is the response which counts. As I have said in my post, you don't need to give them the answers. I was only talking about the attitude. It was not hostile, but distant. That's all. :| When you tell someone to google something, just explain to him why you are not giving the answer. Many people do not know that the best way to learn is to 'teach him how to fish' so to speak. They will just assume that you are unhelpful, which is not the case. :doh: In anycase, I suppose everyone helps in their own way. What can I say. And indeed the best way to help is to 'teach a man to fish' as they say.

                    Pete O`Hanlon wrote:

                    Thanks for the insight, especially as I spend a lot of my time answering questions for people.

                    Every member of this site is a contribution, whether they ask questions or reply to them. We all supply this large FAQ with puzzles and solutions.. somewhat. And for that, they are a credit to such a community. And for that, I hope none of this ramble has affected the professional relationship between coders such as yourself and I. Take care, and be gentle ;P

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #9

                    Don't worry about it, and I must apologise about my rambling response last night - that's what happens when you answer emails immediately after putting the kids to bed. Seriously though, I honestly don't mind if you disagree with me or not. If I can answer your questions then I will, and as I stated earlier, if I think there's room for a little personal journey there, I will post a hint. If the hint takes you nowhere, I'm always available for clarifications - that's the beauty about being the boss, I get to set my priorities:-D.

                    Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world." Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that." Deja View - the feeling that you've seen this post before.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups