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. Hey need help of adding data T__T

Hey need help of adding data T__T

Scheduled Pinned Locked Moved Database
helptutorialquestion
4 Posts 3 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.
  • A Offline
    A Offline
    Al Arcilla
    wrote on last edited by
    #1

    EDIT: I Guess this makes my problem clearer i have 2 tables Mother with Columns (Name,NameKey) and Children with Columns(child,childkey,Mother.NameKey) i want to connect 2 tables and insert many children in 1 mother is this code possible? can't try it right now insert into children(mother.namekey,child) values (Select namekey from mother where name='TELMA'),BEN,RON,DONNA) i know my codes above have errors even w/o trying it. i just want to know how to make that happen and get this output MOTHER- CHILDREN TELMA..............BEN ............................RON ...........................Donna

    S L A 3 Replies Last reply
    0
    • A Al Arcilla

      EDIT: I Guess this makes my problem clearer i have 2 tables Mother with Columns (Name,NameKey) and Children with Columns(child,childkey,Mother.NameKey) i want to connect 2 tables and insert many children in 1 mother is this code possible? can't try it right now insert into children(mother.namekey,child) values (Select namekey from mother where name='TELMA'),BEN,RON,DONNA) i know my codes above have errors even w/o trying it. i just want to know how to make that happen and get this output MOTHER- CHILDREN TELMA..............BEN ............................RON ...........................Donna

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      Have you tried (have assumed that this is SQL Server)

      insert into family (children) values
      select 'ben'
      union
      select 'ron'
      union
      select 'donna'

      Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

      1 Reply Last reply
      0
      • A Al Arcilla

        EDIT: I Guess this makes my problem clearer i have 2 tables Mother with Columns (Name,NameKey) and Children with Columns(child,childkey,Mother.NameKey) i want to connect 2 tables and insert many children in 1 mother is this code possible? can't try it right now insert into children(mother.namekey,child) values (Select namekey from mother where name='TELMA'),BEN,RON,DONNA) i know my codes above have errors even w/o trying it. i just want to know how to make that happen and get this output MOTHER- CHILDREN TELMA..............BEN ............................RON ...........................Donna

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Al Arcilla wrote:

        i have a table family
        columns (MOTHER,CHILDREN)

        How did you create it? Can you post the CREATE TABLE statement?

        Al Arcilla wrote:

        how can i have an output like that?

        Is the problem in getting the "output" based on the data, or getting the data in the table?

        Al Arcilla wrote:

        this is the code i try i know this will not work

        What does "not work" mean? Did it execute succesfull or throw an exception? If there was an error, which one? Can you post it? I'm going to guess that your "mother" column isn't a primary key, nor an identity. In that case, it'll need a value when you do the insert;

        INSERT INTO [family] (MOTHER,CHILDREN)
        VALUES ("Mother", "Ben");

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        1 Reply Last reply
        0
        • A Al Arcilla

          EDIT: I Guess this makes my problem clearer i have 2 tables Mother with Columns (Name,NameKey) and Children with Columns(child,childkey,Mother.NameKey) i want to connect 2 tables and insert many children in 1 mother is this code possible? can't try it right now insert into children(mother.namekey,child) values (Select namekey from mother where name='TELMA'),BEN,RON,DONNA) i know my codes above have errors even w/o trying it. i just want to know how to make that happen and get this output MOTHER- CHILDREN TELMA..............BEN ............................RON ...........................Donna

          A Offline
          A Offline
          Al Arcilla
          wrote on last edited by
          #4

          UP for my question

          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