Query of a Query I would think...

So, I have a categories table. It has the name, and then the
subid. If the subid is 0, it is a main category, otherwise it is a
subcategory of the id it holds.
So, if we have books, and that books id is 1. Then we have
non-fiction which is id of 2, but has a subid of 1. There is the
example.
Now for my question. When I output these categories into a
menu list, I want to list the main category so Books followed by
Non-Fiction. So when it outputs into the list menu it looks
somewhat like this.
Books > Non-Fiction
CDs > Rock
Movies > DVD
Where the subid of non-fiction, rock, and dvd is the id of
books, cds, and movies.
Hope that makes sense! Any help would be great.

if you insist on using QoQ, then:
a) 1 QoQ using <cfif> loop in output:
<cfquery name="qryCategories" datasource="mydsn">
SELECT *
FROM tblCategories
ORDER BY name;
</cfquery>
<cfoutput query="qryCategories">
<cfif qryCategories.subid is 0 OR qryCategories.subid is
"">
<cfquery name="qrySubcategories" dbtype="query">
SELECT *
FROM qryCategories
WHERE subid = #qryCategories.id#
ORDER BY name;
</cfquery>
<cfloop query="qrySubcategories">
#qryCategories.name# &gt; #qrySubcategories.name#
</cfloop>
</cfif>
</cfoutput>
or:
b) 2 QoQs:
<cfquery name="qryCategories" datasource="mydsn">
SELECT *
FROM tblCategories;
</cfquery>
<cfquery name="qryMainCategories" dbtype="query">
SELECT * FROM qryCategories WHERE subid = 0 OR subid = ''
ORDER BY name;
</cfquery>
<cfoutput query="qryMainCategories">
<cfquery name="qrySubcategories" dbtype="query">
SELECT *
FROM qryCategories
WHERE subid = #qryMainCategories.id#
ORDER BY name;
</cfquery>
<cfloop query="qrySubcategories">
#qryMainCategories.name# &gt; #qrySubcategories.name#
</cfloop>
</cfoutput>

Similar Messages

  • How do I gift a song from an album I've already bought? I would think apple would make this easier. Total beat down., How do I gift a song from an album I've already bought? I would think apple would make this easier. Total beat down.

    How do I gift one song from an album I've already bought? It's not working from my iPhone or my ipad.
    Would think apple would make this easier. Total beat down.
    Thanks in advance.
    Cheers.

    Find the song in the iTunes Store and gift it!
    I just did that successfully with a song I previously bought, and it works just fine:
    Just click the down facing arrow to the right of "Play".

  • Using Itunes, I copied all my apps from my Ipod touch to a new Iphone 4. Problem is all the apps on the Iphone are starting up like a new install. I would think my "password" app and "lose it" app would have the past data transferred to the Iphone.

    Using Itunes, I copied all my apps from my Ipod touch to a new Iphone 4. Problem is all the apps on the Iphone are starting up like a new install. I would think my "password" app and "lose it" app would have the past data transferred to the Iphone. Is this not possible??

    Try this Discussion...
    https://discussions.apple.com/message/19529357#19529357

  • Simple (you would think) Automator workflow

    Hi all,
    I have been using Mac for the last 3 years. I have a very good knowledge of computers in general, Unix/Linux in particular but I have never used Automator. I would like to create a very simple application in Automator: when I click on the application icon I want to see a form in which I type the name of a song and as a result I want to see a window that contains all the music files that match that name.
    I have no problem in creating this as a unix shell script and I know I can use spotlight (the problem with spotlight is that everytime I have to type the search string, click on Show All, then refine the search by setting Kind=Music etc.)
    So I thought it would be a piece of cake to do it in Automator.
    I'm using the action "Find Finder Items" with "Name Contains" AND "Kind is Audio". If I run this in automator I get the results I want (if I click on the Results tab). However, when I save it as Application and then double click on it, I get the input window in which I can specify the name of the songs I'm looking for (so far so good) but then nothing appears, the application seems to terminate correctly but I am never presented with the results.
    I have tried to add a "Reveal Finder Items" after the first action but that's not what I want as it opens one window for each file that matches my search and each window shows all files, with the one I'm looking for highlighted.
    What I need is something similar to spotlight, I want a window to open, showing all files that match. I know I can add more actions and for example copy all files that match into a specific folder then open the folder, but that's a dirty way of solving my problem and a bit of an overkill. Aliases would be slightly better, but still not exactly what I want.
    This is driving me crazy, you would think it should be a very easy thing to accomplish with Automator...
    Any help would be greatly appreciated.
    TIA
    /Pippo

    thanks, but it still doesn't do what I want.
    1) not all my music is in iTunes, so I can't use the Find in iTunes action
    2) adding a Choose from List (as you suggested) after the Find Finder Items now shows me a list of all matches, so that is an improvement, thanks, but I stil can't do anything with that. What I need is a Finder window with the result of the search so that I can simply QuickView the song (or copy it or whatever)
    3) using the Finder search is similar to using spotlight, it doesn't do what I want, I don't want to have to type each time that I'm only looking for songs.
    I just want an Automator workflow that:
    1) asks for a file name
    2) searches my computer for audio files that match the name
    3) shows the result in a window where I can then work with the files.
    it really bugs me that I can't make Automator perform such a simple workflow, I'm sure I'm missing some obvious action.
    please help
    TIA
    /pippo

  • I do not like inbox search and want to use google but i cannot find any way to remove inbox--in fact when i search for it to remove you would think it is not there--but it is and i cant get it off. anyone know how?

    Question
    i do not like inbox search and want to use google but i cannot find any way to remove inbox--in fact when i search for it to remove you would think it is not there--but it is and i cant get it off. anyone know how? edit
    Details

    What you should see on a restart is a black screen followed by a screen with the Apple (at which point you let go of the two buttons). There is no progress bar, just the Apple. The Apple will stay there for 15 seconds or so, then the "Slide to Unlock" screen will redisplay.
    But, I don't think the reset will fix it for you. I just tested it, and it comes back on with the zoom still on. The only way to get it to zoom out is the tapping with the 3 fingers.
    I said to double-tap....MY BAD! You need to triple-tap with three fingers!
    Try that and see if it will display the zoom menu for you, or if it will zoom back out.
    Cheers,
    GB

  • You would think Verizon would Appreciate their customer

    You would think a Verizon Wireless being a leader in a competitive market place would put customers first, fulfilling their commitments and especially respect for long time customers time.
    In a nutshell.   I notice my December bill is about $30 more than previous months.  So I call customer service on 12/6/12 and talk to Ron,  he goes on to tell me that a promotion I was on expired. I asked him to show me where I would know that, he made a lot excuses and kept me on hold for a long time and never came with anything.  Then he said we extend your two promotion, wait let me put it in the system. Then is reviewing it and says he is extending the promotion for one year and I said you said two years before.   He then said I am going to transfer you over to the promotion department who will fulfill the request .  That’s when he transferred me to Ron, rep#  who told me he can’t do anything and don’t know why the Ron told me he could do that since he is not even in the department that understands the promotions.
    What gives hear?    I want Verizon Wireless to expend the promotion on my account for two years as YOUR REP COMMITTED and adjust all my bills where the promotion dropped off without wasting another hour time.  This would be a good place for the CEO to listen to the recorded conversations to see what is really happening in the trenches. They should also looked how something like this almost put Home Depot out of business.   We all do have choices and the I hope Verizon and the competitors like ATT Wireless, Tmobile and Sprint take note of this.
    I expect a prompt reply and action immediately.  Hello social media……..
    >Post edited to remove employee ID numbers<
    Message was edited by: Verizon Moderator

    Verizon is huge.  They have a lot of departments.  I call them all the time to ask about my plan and bill.
    The rep you spoke to should have sent you to the billing department or walked you through your bill for that month. A detailed version is on this website, it shows all phone numbers called and when.  I use the Verizon app to check my bill on the reg.
    I left Verizon once and tried a lot of other services (t-mobile, metro, simple, pageplus).  Ever call 611 while on metro? I did.  I'm back on Verizon, nough said.
    I think he sent you to the promotions/loyalty department probably because you were probably "angry".  That department has offers and authority to make customers happy in some cases.  They have authority that customers service does not have.
    Bottom line, "Ron" was trying to help you out and is human.

  • HT4623 This really ***** that they sent out and update to the iPhone ISO6 and I can't send or receive pics! Being that its apple you would think they would know better than to send out a bad update like this! I'm paying for a service and I can even use it

    This really ***** that they sent out and update to the iPhone ISO6 and I can't send or receive pics! Being that its apple you would think they would know better than to send out a bad update like this! I'm paying for a service and I can even use now!!! I'm very upset! Think about canceling my iPhone 5 order! This is terrible!

    Wahhhhhhhhhh! Wahhhhhhhhhh!
    Are you over your little tantrum now?  Do you want help you would like to continue to act like a toddler?
    If you want help, try telling us what happens when trying to send pics.  Any errors?
    If you want to whine... go somewhere else.

  • Any body would think we have all day to muck about......all I want to do is add my windows live mail icon to the site 2hrs on and no luck ......

    any body would think we have all day to muck about......all I want to do is add my windows live mail icon to the site 2hrs on and no luck.....

    in case you are referring to the mail client/desktop program called windows live mail, you cannot integrate that into your firefox. since windows live mail is developed by microsoft they may have integrated it into their own internet explorer browser but likely won't to so for any third party software.
    for quick access to your mails you'd either have to put a shortcut of the programm onto the windows taskbar or use a firefox extension (like the ones mentioned before) to directly monitor the webmail versions of your email accounts.

  • Reasons why a query timeout would fail to cancel the query

    Let's say I am running an SQL query via JDBC and then I hit the query timeout I had set on the session. 9 times out of 10 Oracle complies and I get hit with a ORA-01013 user canceled query, as I would expect. But sometimes, it seems the database just doesn't abide by my request. Is that possible? I know it's a "request", so is it truly a request and not a demand? :) Can the database choose to not obey the request or could it be in some state where it cannot comply even if it wanted to?

    Oracle Enterprise Edition 10.2.0.3.0. The application is my application, a Java application that uses Hibernate sessions to communicate with the database in read only mode. I have a query timeout set on the Query object for a particular query. On my instance (Oracle 11g) i never see the occurrence. Oracle always cancels the query with an ORA-01013 right at exactly the 3 minute timeout. On their Oracle 10 instance, we see examples of the query surviving the cancel request and running as long as 10 minutes.

  • N00b query: Why would anyone ever want to define their own Exception class?

    I've been reading thru my Java textbook for the past couple hours.
    Exceptions are a wonderful thing. I already found several instances where I could've implemented try/cacth in my earlier programs.
    Anyway, getting back to the point. My question is, can someone give me a realistic situation/example where a custom Expcetion class is REQUIRED? (the key word here is "required"!)
    I can see why someone would want to have his own Exception class..... e.getMessage() as custom error messages are SO DAMN COOL!!!!!! :P
    hehe
    But seriously, if you are making intermidiate/advanced Java programs, would you ever REQUIRE to make your own Exception class? Afterall, even a custom made Exception class always "extends" from a pre-defined Java class, right?
    Let me make this a bit more clear... public class CustomException extends IOException{  }Now, if I am making a try/catch statement, I can simply say
    try{
    throw new CustomException;
    catch (IOException e) { }
    Now as you can see, the CustomException was caught by the catch claus, because IOException is the superclass of CustomException. So, in other words, the whole CustomException thingy didnt do anything useful.
    I know I know, I am so naive. Enlighten me >.<

    Sure. Say you want to have a system where you want to include a custom error code which maps to some internationalized error messages. You would create an Exception subclass with a field to hold that value separate from the normal "default" message. Then you could throw that exception in all your code. Other code can catch it as a plain Exception if they want and use the "default" message, which is okay if they don't really care about the error code.
    I don't think you are ever "required" to make your own exceptions. I have done so, but I don't often. It depends. See, there are plenty of Exception subclasses in the standard packages, and most of them cover many of the things you need. So more often if I'm throwing an exception, I'll be using the already existing ones, like IllegalArgumentException or IOException (whatever is relevant to the code).
    Yes, you can do what you did below with CustomException. However the reason you might do that is cuz you really want to do this:
    try {
       // call some code that may throw IOException from some standard IO package
       // or may throw CustomException from some of my methods...
    } catch (CustomException ce) {
       // handle cusotm exception
    } catch (IOException ioe) {
       // handle IO exception
    }Cuz you may want to differentiate between your exceptions vs. IOExceptions that might be thrown from some java.io class.
    Usually when you use an exception class it's a named class that relates to some condition. It may hold additional information besides the standard message, but I think most of the time it's just the class name which describes the problem. And if there isn't one that describes the problem that you're code might encounter, then create a subclass.

  • How To Reset a Form (Not as easy as you would think)?

    Hi All,
    I'm unable to get a form to reset its value when using a commandButton that has immediate set to true.
    I've got a simple little jsf page that has a form and a datatable. The form is bound to an object in a class I'm using to handle the view, the datatable is bound to a dataModel from the same handler class. The functionality I have is quite simple:
    a user clicks on a commandLink in a row of the datatable
    the corresponding object is loaded into a "currentObject" property of the handler class
    the form fields are mapped to the "currentObject" property of the handler.
    The user may update or reset the form.
    The goal is to have the reset commandButton set the "currentObject" property of the handler class to null (or a new, unpopulated object) so that the fields of the form are set to blank again on render. This works fine as long as I don't use immediate="true". When I do use the immediate=true attribute, the "currentObject" variable is, indeed, set to null, but the form still renders with the old "currentObject" values in it!!
    I have to use immediate="true" because there is validation going on for the form that I want to avoid.
    If I use a commandButton type="reset", the fields are not cleared because the reset functionality of the browser (ie6 and firefox) resets the fields to the values they were at the time the form was displayed--the very values I wish to totally remove!
    This seems like such a common, simple thing to do. What am I missing?
    Thanks,
    John

    I have a similiar problem, and maybe putting buttons in a different form is the answer:
    I have a page with a selectOneListbox on the left, and a set of inputs on the right. The listbox represents the available beans to select, and the set of inputs contains all the editable fields for the beans. Basically this is just a bean editor.
    There is a command Button beneath the listbox for viewing a bean. When this button is clicked, the set of inputs are populated with that bean's data.
    There is also a command button beneath the set of inputs that allows the user to save their changes.
    All of these elements are in the same form tag.
    JSF jsp:
    <f:view>
      <h:form>
        <h:panelGrid columns="2">
          <h:panelGrid columns="2">
            <h:selectOneListbox size="10" value="#{editor.selectedBean}" >
              <f: selectItems value="#{editor.beanSelectItemCollection}" />
            </h:selectOneListbox>
            <h:commandButton actionListener="#{editor.view}" value="View" />
          </h:panelGrid>
          <h:panelGrid  columns="2">
            <h:inputText value="#{editor.editingBean.property}" />
            <h:commandButton actionListener="#{editor.save}" value="Save" />
          </h:panelGrid>
        </h:panelGrid>
      </h:form>
    </f:view>Editor bean:
    public class Editor {
      // use a blank bean as default
      // so the editor is populated with blanks
      private Bean editingBean = new Bean();
      // don't initially select any beans
      private Bean selectedBean = null;
      private Map beans = new HashMap();
      public Editor() {
      public void save(ActionEvent e) {
        beans.put(editingBean.getId(), editingBean);
      public void view (ActionEvent e) {
        editingBean = (Bean)selectedBean.clone();
      // getters and setters
      public Bean getEditingBean() {
        return editingBean;
      public void setEditingBean(Bean b) {
        editingBean = b;
      public Bean getSelectedBean() {
        return selectedBean;
      public void setSelectedBean(Bean b) {
        selectedBean = b;
      // before entering the JSP for this bean, this method should be called
      // to populate the editor
      public void setBeans(Collection c) {
        beans.clear();
        for (Iterator i = c.iterator(); i.hasNext(); ) {
          Bean b = (Bean)i.next();
          beans.put(b.getId(), b);
      public Collection getBeans() {
        return beans.values();
      public Collection getBeanSelectItemCollection() {
        Collection items = new ArrayList(beans.size());
        for (Iterator i = beans.values().iterator(); i.hasNext(); ) {
          items.add(new SelectItem(bean, bean.getProperty());
        return items;
    }Here comes the problem:
    If I want to set fields as required or use any of the JSF validation functionality, my view usecase breaks. This happens if the user views bean1 changes some data to be invalid/not existant and then tries to view bean2. If they don't click the save button, validation/required should not be checked. My initial thought is that I should be able to set my view button and view listbox to be immediate. This does properly update the view listbox, but then if I change the values in the backing bean for the set of inputs, those changes are never updated to the screen, and the set of inputs is still populated with bean1's data even though the backing bean for all those inputs is now bean2.
    It appears that the view never requeries the backing bean when responseComplete() is called (which happens with an immediate command). Is this a bug in faces, or is this how the spec says it is supposed to behave? If this is the correct behavior what is a better practice to acheieve my usecase?
    My current workaround is to ignore faces validation and manually validate when the user clicks the save command, and then manually set the messages for the bad components. Obviously, this is not an ideal solution, but I was hoping that this faces behavior was incorrect and thus my solution would be temporary.
    I'm not tied to a specific solution, but I am discouraged that Adam says in order to reset the set of inputs, we have to manually update the model during the apply request values phase.

  • HT2736 I do not understand why the simplest of tasks do not appear next to each other in a list of links. You would think tht "Reedem" an item would be right next to "Gift" an item, burt for some reason that just does not make sense to Apple.

    I never did find the "Gift Certificate" link even thoug support said where it "should" be, and "No" Nowhere near where you would reedem them.

    mojaleski wrote:
    When I want to read something in e-mail or which I downloaded and want the font large enough for me to see and expand with my fingers...the content then doesn't resize the shape to fit on the screen and I have to keep going from left to right to left back and forth in order to read it. Seems like it should automatically become an elongated column to fit the viewing area with just less words per line. PLEASE fix this so I can enjoy reading with larger type size to accomodate my eyesight.
    Double tap the column to make it size to fit. It will make it fit the width but not make the font larger by putting less word on a line.
    Hard to make corrections as it is hit or miss to get in between letters in a word.
    Tap and hold to get the magnifying glass or better still get the iPad User Guide which is free in iBooks - it has pictures and will save me having to type so many words to try and answer your questions
    Is there no way to scroll up or down deleting as you go...so far all I can do is delete one word/line at a time, ie in forwarding e-mail and trying to get rid of the long list of other people's contacts.
    Yes, I'm replying to this on my iPad - again, much better described in the User Guide.
    Thank you
    You're welcome. But please do have a look at the iPad User Guide - it will make things clearer and you may even find something new that you didn't already know.
    Regards,
    Colin R.

  • All my books inc pdfs gone.  ibooks keeps crashing.  You would think that Apple was fragmentized as it seems to be.

    What happens now, doesn't seem to be an update for ibooks.  Are all my books in the cloud so when you ever fix it I can get them that way?
    Updated to Yosemite on my mac and my iPad is os 8.2

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Step 1
    For this step, the title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen.
    In the top right corner of the Console window, there's a search box labeled Filter. Initially the words "String Matching" are shown in that box. Enter the name of the crashed application or process. For example, if iTunes crashed, you would enter "iTunes" (without the quotes.)
    Each message in the log begins with the date and time when it was entered. Select the messages from the time of the last crash, if any. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    ☞ The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    ☞ Some private information, such as your name, may appear in the log. Anonymize before posting.
    Step 2
    In the Console window, select
              DIAGNOSTIC AND USAGE INFORMATION ▹ User Diagnostic Reports
    (not Diagnostic and Usage Messages) from the log list on the left. There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points down. You'll see a list of crash reports. The name of each report starts with the name of the process, and ends with ".crash". Select the most recent report related to the process in question. The contents of the report will appear on the right. Use copy and paste to post the entire contents—the text, not a screenshot.
    I know the report is long, maybe several hundred lines. Please post all of it anyway.
    If you don't see any reports listed, but you know there was a crash, you may have chosen Diagnostic and Usage Messages from the log list. Choose DIAGNOSTIC AND USAGE INFORMATION instead.
    In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
    Please don’t post other kinds of diagnostic report—they're very long and rarely helpful.

  • I have the jetpack wifi and someone told me I need to change the name to FBI Surveillance Van so others would think twice before using it how do i do it?

    I have the jetpack wifi and someone told me I need to change the name of it to "FBI Surveillance Van so that people would not try to tap onto it. How do I accomplish this?

    Changing the SSID is a good idea, but I do not suggest changing it to something so troll enticing as "FBI Surveillance Van".  A SSID like that is only going to draw attention to you and your network and challenge malicious users to target you.  I advise not putting a target on your back and stick to a custom but not well known SSID.
    I normally suggest broadcasting an SSID of something a little less confrontational.  Something like combining your favorite color with your favorite sports team.
    All jetpacks are a little different but they should all have a way to sign in and complete configuration changes.  If you connect to your Jetpack and look up the IP Address of your Default Gateway you will know the IP of the Jetpack.  Plug in the IP Address of the Jetpack into a web browser and sign in with the admin password.  Review the security options that are available until you find a SSID or broadcast name or network name field.
    While you are at it you should also make sure you have a custom WiFi password configured with WPA2 security.  Custom WiFI passwords are going to be much more helpful than a creative SSID at keeping malicious users off your network.  Rule of thumb for WiFi passwords is the longer the better.
    A good tool to evaluate your WiFi password is here (shoot for at least a few years):
    www.howsecureismypassword.net
    Let us know if you want any other security best practices or tips.

  • Downloaded iOS 8.2 on ipad3 and won't respond to code or turn on turn off button. Can't sync with my iMac either? You would think after iOS 8.1 apple would learn their lesson.

    Downloaded iOS 8.2 and now won't respond to code or turn on and off button. If pressed Siri comes on and says connect to internet. iMac can't connect to iPad either? With ios8.1 fiasco apple would not release another problem.

    do not download ios 8.2 it totally destroyed my iPad 2 , and hour after the update it gave me a black screen with the date and the battery status and that's it it wont shutdown itune will not reset cause of the find my ipad
    DO NOT UPDATE to 8.2

Maybe you are looking for

  • Error in using the tds2xx Example2.vi

    When I run it, it comes an error "Property Node in TKTDS2XX Write.vi->TKTDS2XX Set-Query SESER.vi->TKTDS2XX Set Conditions for SRQ.vi->TKTDS2XX Example2.vi" which I don't understand, since I am just a beginner. Anyone can tell me what the error is an

  • How to handle this payment scenario in SAP

    Hello Gurus, Can anyone please help me with how we make this payment in SAP. Customer A is the alternate payer for Customer B. We gave customer B a credit memo. When customer A is making payments, customer A wants to use the credit memo assigned to c

  • Solaris + iPlanet 6.0SP2 + PHP 5.1.2 + Instant Client

    Configuration: Solaris OS 5.8 (64bit) iPlanet 6.0 (SP2) (32bit) PHP v5.1.2 (32bit) Instant Client 10.2.0.1 (32 bit) I am able to compile and install php 5.1.2 and Instant Clinet 32bit libraris with my iPlanet Server. When i invoke a php script that c

  • Has ayone experienced any problems withe latest apple tv update

    who has experienced problems withe latest apple tv update???

  • XML Report in text format

    Hi, Can any one help how to create a XML report so that i should be saved in text format OR is there any way where when you click on view output a dialog box with open, save and cancel option appears so that i can save the output in required format.