Sql insert with inner join

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • readbanana
    New Member
    • Jul 2010
    • 37

    Sql insert with inner join

    I have a table called products. it holds information about all products that we sell. To pull up a specific suppliers products, i do an inner join to another table that holds the supplierid. now i want to add products based on that same supplierid that is stored on the second table.
  • Meetee
    Recognized Expert Contributor
    • Dec 2006
    • 928

    #2
    This question is more suitable to DB forum. Moreover, you have not properly described your problem in detail. Please share the table definitions here. Skeleton for inner join is:
    Code:
    SELECT column_name(s)
    FROM table_name1
    INNER JOIN table_name2
    ON table_name1.column_name=table_name2.column_name
    Hope this helps.

    Comment

    • readbanana
      New Member
      • Jul 2010
      • 37

      #3
      I know how to make a regular join. I am not trying to make a regular join. I have a table called products. I have another table suppliers. the products table does not have a supplierid. what i want to do, is create a new product in the products table connecting it to the supplierID in the suppliers table.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32666

        #4
        We'd like to help, but you haven't actually asked a question.

        Welcome to Bytes!

        Comment

        • readbanana
          New Member
          • Jul 2010
          • 37

          #5
          whatever i realize what my problem is thanx anyway

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32666

            #6
            Originally posted by readbanana
            readbanana: I have a table called products. I have another table suppliers. the products table does not have a supplierid. what i want to do, is create a new product in the products table connecting it to the supplierID in the suppliers table.
            Are you asking how to link a product in the Products table to a supplier in the Suppliers table but without having a field in the Products table that handles the join?

            If so, I'm afraid the answer is that it's not possible. That's the whole point of the field being required in the first place. Joins are done using PK/FK matching. That is Primary Key/Foreign Key matching. Technically any Unique Key can be used in place of a PK, but you need an FK to link to something.

            If this isn't what you're asking, could I ask you to explain clearly what that is. It's a bit difficult helping without a question that makes sense. Maybe take a few minutes of your time to ensure it can be understood.

            Comment

            • readbanana
              New Member
              • Jul 2010
              • 37

              #7
              no, i have a field that can join them both - the connect through the productid its more that i'm trying to add a product to the product table and i need to link it to the supplierid in the the suppliers table

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32666

                #8
                There still seems to be some sort of gulf in understanding here. As you provide extremely little in the way of information it's hard for me to determine exactly what it is you're failing to grasp. Hence my request that you give a little more consideration to your reply.

                If you have a link already then why do you need further help? If, as I suspect, that link can only identify the product from the supplier, as opposed to the other way around as you seem to require, then you're back where I left you earlier, which is requiring a supplier reference in your product table.

                Unless you make the position clearer with your next post I can't imagine I can help you any further.

                Comment

                • readbanana
                  New Member
                  • Jul 2010
                  • 37

                  #9
                  ok. lets forget this. thanx anyway

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32666

                    #10
                    New question from the OP was moved to it's own thread (Delete Word in Field).

                    Comment

                    Working...