Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Posts
    36

    Unanswered: query to return only non null fields

    Is it possible to write a query that returns only non null fields from a specified record? I have a big table with a record for each customer. the record contains a field for each item that can be purchased (only 6 items). I need to write an invoice but not every customer buys every product. I get the feeling Im going about this all wrong. Any help would be great

    Thanks

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: query to return only non null fields

    Originally posted by nicky w
    Is it possible to write a query that returns only non null fields from a specified record? I have a big table with a record for each customer. the record contains a field for each item that can be purchased (only 6 items). I need to write an invoice but not every customer buys every product. I get the feeling Im going about this all wrong. Any help would be great

    Thanks
    It would have been better to have the up to 6 items as up to 6 records in a separate table. No SQL query can return a variable number of columns, you would have to write some procedural code to run the query and then present the NOT NULL data.

  3. #3
    Join Date
    Nov 2002
    Posts
    833
    are you still in a designing stage? then you should change the design.
    What if more items will be offered?

    referential integrity will prevent "lost childs"

    otherwise andrew is right. write some procedural code

Posting Permissions

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