SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question: Single query or multiple queries

    Hi All,

    I am developing a web-based application for my friend for a process that uses an Excel sheet currently.

    I have attached the Excel sheet for reference.
    I have created the database structure as under:

    entity
    -eno
    -ename

    check
    -eno_fk
    -cno
    -check_text
    -check_field1
    -check_field2
    -check_field3
    -check_field4
    -istitle


    steps
    -cno_fk
    -stepno
    -steptext


    obs
    -stepno_fk
    -obsno
    -obstext
    -obsdate


    eff
    -cno_fk
    -effect
    -edate


    I want to know the optimal way of writing a query to display the excel sheet structure in the web-based application.

    I have written a query, but for each "step" the "check_text" is repeated.
    I need help in how to query in a way such that I can display the exact structure of the excel sheet.

    Hope somebody can help!!
    Other tips are welcome too

    Thanks and Regards
    Sam
    Attached Files Attached Files

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,338
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    you're not going to get multiple values in a single cell easily

    better to return a "flat" result set from the query (one value per column, no blank columns), which will include duplication of check data for all steps in a check, and then post-process with your application language (php or whatever) when looping over the result rows
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks "r937" for replying and sorry for being so late.

    The final method that I have used is to have multiple queries and some processing in the application as also suggested by you.


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
  •