Multiple output from singe search query

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Multiple output from singe search query

    I have a search page that searches a database table of technical articles on a
    computer support site. In the table, there are bit columns for HotTopic and
    ET. When adding an article, the technician sets ET=1 and/or Hottopic=1.
    Currently the search outputs the all of the results ordered by date. I would
    like to output the HotTopics first, then the ET articles, then everything else.
    I don't want to have to run the query 3 times during search processing. Is
    there a way in my output to take the single query results and output the
    results something like this:

    Hot Topics
    -only articles where hottopics =1
    ET Articles
    -only articles where ET=1
    Everything Else
    -all other records

    OR do I need to write 3 separate queries where query one select articles where
    hottopics=1, query two selects articles where ET=1, and query 3 selects all
    other articles?

    What is the most efficient way to do this?

    I was thinking I could use a <cfloop> and <CFIF> statements to loop through
    the output to separate these 3 levels out. My query is very large with a ton
    of conditions, so I don't really want to repeat it with different where
    clauses. Code is far too much to include here.

    Any general suggestions on an efficent approach? Any basic example code?

    I appreciate the help.
    Don

    dkerr Guest

  2. Similar Questions and Discussions

    1. CFFILE output multiple rows from a query
      I have a quiestion about the below. I am working with this method, but I find that my code results in the first record being outputed twice in the...
    2. Query problem with multiple records output
      ABERDEEN, , GB ABERDEEN, MD, US ABERDEEN, MS, US ABERDEEN, NC, US ABERDEEN, SD, US ABERDEEN, WA, US Results as above from a search form...
    3. ANN: InterAKT Site Search - search in multiple tables
      Hello, We have just released a new product, MX Site Search, meant to help web developers and designers create a search form in their dynamic...
    4. CAML Query: Multiple Query Fields Issue
      I need to Create a CAML Query Dynamically with VB to a Sharepoint WebService GetListItems Method. The User Could Select 1 to X Number of IDs...
    5. Search multiple keywords across multiple fields
      Hi, I'm about halfway through building a search engine using ASP, SQL and Access. As part of that search engine I need to search multiple...
  3. #2

    Default Re: Multiple output from singe search query

    Use query of queries.
    Dan Bracuk Guest

  4. #3

    Default Re: Multiple output from singe search query

    Thanks. But what is it? Does it work with MX 6.1?
    dkerr Guest

  5. #4

    Default Re: Multiple output from singe search query

    Yes it works with version 6. Put "coldfusion query of queries" into a google text box for lot's of good info.
    Dan Bracuk Guest

  6. #5

    Default Re: Multiple output from singe search query

    Thank you. This will work. Found a nice basic tutorial...
    [url]http://www.sitepoint.com/article/query-queries[/url]
    dkerr Guest

Posting Permissions

  • You may not post new threads
  • You may 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