Professional Web Applications Themes

Nested Queries - Microsoft SQL / MS SQL Server

I have a user defined table with a variety of information with a variety of meanings. Each record has an identifing key from another table associated with it to tell me what the data means. Problem: I need to pull out 5 groups of informaion from the user defined table that links to table DDTORD which contains an order number. Each user defined field has an order number associated with DDTORD. I want to pull every order number from DDTORD and each user defined field associated with the order number in the same record. So, I would have a record ...

  1. #1

    Default Nested Queries

    I have a user defined table with a variety of information
    with a variety of meanings. Each record has an
    identifing key from another table associated with it to
    tell me what the data means.

    Problem:
    I need to pull out 5 groups of informaion from the user
    defined table that links to table DDTORD which contains
    an order number. Each user defined field has an order
    number associated with DDTORD.

    I want to pull every order number from DDTORD and each
    user defined field associated with the order number in
    the same record. So, I would have a record that looks
    like the followig:
    ORDER NUMBER UDF UDF UDF UDF UDF

    UDF stands for user defined field. Once again, if there
    is no inormation associated with the UDF it would show
    null. Also, there may not be an order number for the UDF
    in the DDD2 table. (Not every UDF is associated with an
    order number)

    I would appreciate any help!

    Thanks
    Brian Shannon
    Brian Shannon Guest

  2. #2

    Default Re: Nested Queries

    >> I have a user defined table with a variety of information with a I
    have a user defined table [sic] with a variety of information with a
    variety of meanings. Each record [sic] has an identifying key
    [redundancy] from another table associated with it to tell me what the
    data means. <<

    That first paragraph is total nonsense:

    1) SQL uses rows and not records -- major difference.

    2) Users do not define tables; they use them. DBAs declare tables in
    the DDL.

    3) Does the concept of a "non-identifying key" make sense?

    4) A table is a set of one kind of thing; by definition, it cannot
    contain "a variety of information"; it contains "one and only one kind
    of information" -- a werid phrase, but closer to the definition.

    5) The scalar values in the columns of each row are drawn from **one and
    only one** domain (see First Normal Form and the definition of a
    relation); they cannot ever have
    "a variety of meanings".
    >> UDF stands for user defined field [sic]. <<
    There are columns in SQL, not fields -- major difference.

    Even if your request made any sense, you did not post DDL, so that
    people do not have to guess what the keys, constraints, Declarative
    Referential Integrity, datatypes, etc. in your schema are.

    You need to get a book on relational design and start over. I am sure
    you can kludge together an unmaintainable nightmare and do a million
    monster joins to obtain unverifiable results without an data integrity
    in a fantastic amount of time. But please don't; you will ruin your
    employer's database.

    --CELKO--


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Joe Celko Guest

  3. #3

    Default Re: Nested Queries

    Well Joe, Thanks for the help.

    First of all I am learning about database design and have
    not been at it for very long.


    Second, I am using a Deacom Managment Software package
    that designed the database. The UDF's were created to
    gather information that Deacom doesn't supply.

    If you don't know the answer just say it instead of
    trying to cut someone else down to try and make yourself
    sound better.

    I came into this project recently and was handed a pile
    of data. For know, I have to deal with what I was given.

    I hope you feel much smarter now after helping someone in
    need like you just did. If you don't like what people
    post maybe you should just keep reading your databse
    design book and keep your knowledge to yourself.
    Brian Shannon Guest

  4. #4

    Default Re: Nested Queries

    >> am using a Deacom Managment Software package
    that designed the database. The UDF's were created to
    gather information that Deacom doesn't supply. <<

    Did they give you the DDL or not? Generally, UDF is a bad way to go
    because it prevents the use of indexes and keeps the optimizer from
    doing its work.
     [/ref]
    your database design book and keep your knowledge to yourself. <<

    Google my name; I don't read database design books, I write them.

    If you would learn enough to post readable specs, you have gotten some
    (insanely high priced <g>) education and consulting work for free. Oh
    well, ...

    --CELKO--
    ===========================
    Please post DDL, so that people do not have to guess what the keys,
    constraints, Declarative Referential Integrity, datatypes, etc. in your
    schema are.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Joe Guest

  5. #5

    Default Re: Nested Queries

    Joe Celko. I've been thinking about you a lot lately. I didn't know if
    I would ever find you back. I haven't talked to you since I participated in
    discussions with you on Compuserve. I was thinking about going back out
    there to check if you still use the forumns. Check out my email address.
    It's still the same. Your books are some of the most useful books I've ever
    bought.

    I would greatly appreciate any guidance that you could give me. See my
    thread 7/12/03 Stored Procedure Help. There are so many questions that I
    have concerning that thread.

    Thanks tons,
    Jack T.


    Jack Guest

Similar Threads

  1. Nested XML into comboBox
    By leotemp in forum Macromedia Flex General Discussion
    Replies: 3
    Last Post: June 23rd, 10:59 PM
  2. Nested Datagrids
    By Juliano Bortolozzi in forum ASP.NET Data Grid Control
    Replies: 22
    Last Post: October 27th, 04:26 PM
  3. Queries Of Queries Single Quote Problem
    By TimH2O in forum Macromedia ColdFusion
    Replies: 0
    Last Post: April 1st, 07:46 PM
  4. Possible Bug w/ nested loops and queries
    By Flex Architect in forum Macromedia ColdFusion
    Replies: 1
    Last Post: March 16th, 09:46 PM
  5. Nested mySQL queries create issue with validity of result index?
    By jerrygarciuh in forum PHP Development
    Replies: 6
    Last Post: September 8th, 10:09 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139