How do I get multiple hyperlinks to diplay in a query output?

I am using two tables to list all of the sport teams for a school. The sports table lists all of the team data grouped by gender. The second table uses the sportID from the first table to associate the team with a schedule.  The problem is not all teams have a schedule yet.
I am trying to display a link for those teams with schedules. I compare the two tables, sports & schedule and use a CFIF statement to compare the 2 sportIDs in the output to determine which teams have a schedule.  If the two sportIDs match then a hyperlink is displayed.
Unfortuanetely, only one link will be displayed, even though there should be three links. Below is my code:
Table to display the teams grouped by gender
<cfquery name="getSports" datasource="#application.database#">
select gender, team, levels, sportID
from sports
group by gender, team, levels, sportID
</cfquery>
Table used to get the sportID for schedules already created
<cfquery name="getID" datasource="#application.database#">
select sportID
from schedules
group by sportID
</cfquery>
I then compare the sportIDs and if they match, I then display a hyperlink
<cfoutput query="getSports" group="gender">
<h1">#gender#'s Teams</h1>
<ul>
<cfoutput>
     <li>
          <cfif getID.sportID EQ getSports.sportID><a href="teams.cfm?sportID=#sportID#"></cfif>
           #team# <cfif levels GT "">(#levels#)</cfif>   //levels is used to differentiate between J.V. and Varsity. Not all teams use levels
          <cfif getID.sportID EQ getSports.sportID></a></cfif>
     </li>
</cfoutput>
</ul>
</cfoutput>
How do I get the other teams to display their links?

I'm hesitant to give you an example because there are so many ways to do this and I don't want to lead you in a direction that might not be appropriate for what you are trying to do (outside of this code block).
I think WolfShade is on the right track.  I would also use a single query with a join instead of trying to use a condition in a loop.  I think you would want an outer join instead of an inner join though.  You want all rows returned whether or not they have a schedule.  Right?  If so, you should be able to use an outer join and then your condition for the hyperlink becomes whether the schedules.sportID is NULL or not.  I think this would be the best way to handle this.
OR
If you can't do that for some reason, then you need to modify your cfif logic.  You could move your "getID" query inside of your <cfoutput query="getSports"... loop.  Add a where condition to the query "where sportID = getSports.sportID".  Then you can check if the getID.recordcount is greater than 0 (or equal to 1).  If so it has a schedule so create the hyperlink.  Not pretty though, because as you see it will need to query for each record in "getSports" query.
OR
You could keep your queries the same but place a cfloop around your cfif logic to check for each record in your "getID" query.  Again, not pretty because you have to loop over the "getID" query for each record in the "getSports" query.  Something like:
     <li>
          <cfloop query="getID">
          <cfif getID.sportID EQ getSports.sportID><a href="teams.cfm?sportID=#getSports.sportID#"></cfif>
           #team# <cfif levels GT "">(#levels#)</cfif>   //levels is used to differentiate between J.V. and Varsity. Not all teams use levels
          <cfif getID.sportID EQ getSports.sportID></a></cfif>
          </cfloop>
     </li>
OR
You could do a query of a query...  Lots of ways to skin a cat...

Similar Messages

  • How do you get multiple screens on the iPad with iOS 5.1.1?

    How do you get multiple screens on the iPad with iOS 5.1.1? We just upgraded to iOS 5.1.1, and we see no way to be able to open multiple screens at once. Before, there was a small button in the upper portion of any window. That button would take you from a particular window to the place where multiple windows are open at once. Does it do it differently? Is there a special setting button that we have missed? Thanks!
    One more thing: We are only talking about Safari.

    Guitaristica-
    I don't think I've seen a way to have separate Safari screens visible at the same time.  The small thumbnails were deleted in one of the iOS updates, and replaced with a multiple "Tab" system.
    You can open an additional screen in a new "tab" by pressing and holding on a link until a new menu comes up.
    Fred

  • How do i get multiple internet screens going on Safari?

    How do I get multiple internet screens going on Safari at the same time?

    Do you mean "New window" (command-n) or "New tab" (command-t)? Are you in "Full Screen Mode"? If so, hit the escape key to exit that mode before making a new window or tab.  Use Expose/Mission Control to manage windows.
    charlie

  • How can i get multiple photos onto photoshop?

    How do I get multiple photos on to photoshop. I want to work on them together and move one part of one photo onto the other.

    Start by asking in the Photoshop forum
    This forum is actually about the Cloud, not about using individual programs
    For product specific questions you may do better in the specific product forum
    If you start at the Forums Index http://forums.adobe.com/index.jspa
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says ALL FORUMS) to open the drop down list and scroll
    http://forums.adobe.com/community/photoshop

  • How do I get multiple return results from a function

    IDBASKET IDSTAGE DTSTAGE
    3 1 24-JAN-03
    3 5 25-JAN-03
    4 1 13-FEB-03
    4 5 13-FEB-03
    5 3 21-FEB-03
    I input is a single IDBASKET number from this table and this function works fine only if it has one IDSTAGE per idbasket. (idbasket#5)
    But how do I get it to return a result for an IDBASKET when it has multiple IDSTAGE? (idbasket#3 & 4)
    THANKS MUCH,
    MAT
    SQL> CREATE OR REPLACE FUNCTION status_desc_sf
    2 (p_code NUMBER)
    3 RETURN VARCHAR2
    4 IS
    5 lv_output_txt VARCHAR2(30);
    6 BEGIN
    7 IF p_code = 1 THEN lv_output_txt := 'Order submitted';
    8 ELSIF p_code = 2 THEN lv_output_txt := 'Accepted, sent to shipping';
    9 ELSIF p_code = 3 THEN lv_output_txt := 'Backordered';
    10 ELSIF p_code = 4 THEN lv_output_txt := 'Cancelled';
    11 ELSIF p_code = 5 THEN lv_output_txt := 'Shipped';
    12 ELSE lv_output_txt := 'No information';
    13 END IF;
    14 RETURN lv_output_txt;
    15 END;
    16 /

    Duplicate thread:
    How do I get multiple return results from a function

  • How to replace # or Not assigned with blank in BEx Query Output.

    Hi,
    While running the query through BEx Query desginer or Anlayser, I am getting # or Not assigned where there are no values.
    The requirement is to "Replace # or Not assigned with a blank" in the output.
    I want to know, is there any setting in BEx query desginer where we can do this. How to do this.
    Please share your inputs on this. Any inputs on this would be appreciated.
    Thanks,
    Naveen

    Check out SDN-thread: "Re: Remove 'Not assigned'" for more details
    Ideas from SDN research:
    "a solution i have used is to put each RKF column in a CKF colum then in each CKF use RKF + 0, the outcome is that your # should now be 0s, in the query properties you can set the option to display 0s as blank."
    "try to enter a text for the blank entry in the master data maintenance of the relevant objects and set the display option for the objects to 'text'."
    Threads:
    SDN: How to replace # or Not assigned with blank in BEx Query Output.
    SDN: Re: Remove 'Not assigned
    SDN: How to replace # or (Not assigned) with blank in BEx Query Output.
    SDN: Bex Analyzer : Text element system's table ?  
    SDN: change message in web application designer ["nonavailable" ->  136 of SAPLRRSV]
    SDN: Not Assigned ["Not Assigned -> 027 of SAPLRRSV]
    SDN: replacing '#'-sign for 'not assigned' in queries
    SDN: # in report when null in the cube
    SDN: How to replace '#' with blank when there is no value for a date field
    Edited by: Thomas Köpp on Sep 13, 2010 5:20 PM

  • How do I get multiple Apple Tv's to show up in Airplay?

    I have two apple TV's hooked to my network.  iTunes is running on an iMac.   When I click the AirPlay icon, only one of my ATV's show up.  
    How do I get both to show?
    thanks
    David

    Hey David,
    If you are having an issue with being unable to get multiple AirPlay devices such as your Apple TVs to show up in iTunes I would suggest that you troubleshoot using the steps in this article - 
    iTunes: Troubleshooting AirPlay and AirPlay Mirroring - Apple Support
    Thanks for using Apple Support Communities.
    Happy computing,
    Brett L 

  • How can I get multiple users to be able to share the music on iTunes? I've tried Home Sharing, but it does not work properly.

    How can I get home sharing to work on my mac mini for multiple users? It says it is working, but it never shows up in the left hand column.

    Gino Cerullo,
    Thanks for your response. I tried all that myself. In fact, last night, it all worked fine on all users. This morning, no Home Sharing would show up. It is really weird because some setting must have changed, but I did not knowingly changed anything, and now all the obvious fixes don't work. In fact, if I turn off Home Sharing and turn it back on, then it comes up only until I hit the "done" button on the set up page and then it goes away from the left hand column again. The ADVANCED drop down tab says it is on, but it is not there.
    Thanks anyway.
    Edzell

  • How do you get multiple live instruments to put out sound?

    I just got a M-Audio 61 keyboard from my wife for our anniversary. I love it and it works great with GarageBand 1.X. I also have a guitar I use with GB. It is plugged in the 1/8 in. mini jack input in the back of the Mac. I however can't get both to put out sound at the same time. Lets say, for instance, that I would play the guitar and my wife the keys. How can I get both to put out sound at the same time?
    Thank for any help you can offer.
    Your friend in Mac OS X,
    Jose

    Danke Christoph!
    I was glad to get your response. I thought I was not doing something right in GarageBand. I'll get GB2 and try out multiple live sources.
    Once again thanks.
    Your friend in Mac OS X,
    Jose Mauricio Cuervo

  • How do I get multiple disc music CD's to load properly into my iCloud?

    Here is the scenario:   I have several "Greatest Hits" CD's in my personal library that I am attempting to load into iTunes/iCloud.  These CD's comprise two discs.   I loaded these originally on my old PC.....before I signed up for my "cloud".   Yesterday I noticed on my iPad that only one of the CD's is showing up.  So, I loaded the second one  via my new MacBook Pro.   It already had the first CD showing which matched the iPad.  The result,  the Pro now only has the second CD, and the iPad only has the first CD.   I of course want both on both devices.  I checked another "set" by another artist, and found the same scenario.  How can I get ALL of the songs to show up on all of my devices from both CD's?  BTW, I turned off ITunes Match on both devices and restarted it on both devices....the results are after I did that.  

    Thanks for the help, but I do have the latest version installed. 11.0.4.   The computer I am working on is brand new, and I verified the version just to be sure.   So, the fix apparently did not resolve the problem.   I guess I will just have to wait....

  • How do I get multiple tiles to appear on my large piece for printing?

    Hi, I'm working in Illustrator 6. I've got a large piece that I'd like to print onto several 11x17 sheets. When I select Veiw---Show Print TIling, only one tile appears. I expect there to be enough tiles to cover the entire piece and be numbered for me? Where are they? How do I get them to appear?
    Then when I go to Print the tile option in the print dialog is greyed out.
    I know I've done this before in earlier versions.
    Can you please help me?

    You can see a tile view in the preview section of Illustrator Print dialog.
    Choose a printer of your choice and then under the Media Size select 11x17.
    Under Scaling: Tile Full pages and Scale them to any level that suits your preview and thus the output.
    Please refer the image:

  • How do you get multiple plots to show up on the same graph?

    I am trying to get multiple (20) plots to show up on the same XY
    graph.  My data set is a 2D array, which exits a for loop. 
    The ultimate goal is to have one plot show up after each iteration of
    the for loop.  I can only get all 20 to show up at once, not one
    at a time.  Any suggestions?
    Thanks!

    Here is a sample in 7.0 format.
    Attachments:
    20 plots on XY graph.vi ‏31 KB

  • How Do I Get Multiple Video Formats to One Size?

    I am new to Premiere....so, thanks for the help!
    I have several files from different cameras submitted by individuals. They have different resolutions and it is wreaking havoc on my output.
    My previous software automatically adjusted the video to fit the screen.
    How do I get Premiere to do that and at the best quality?
    Thank you for taking the time to take a look.
    Eric

    Hi Eric,
    In Edit > Prefs > General, there is a checkbox for "Auto Scale to Frame Size". Enable that, and any clips imported after that change will automatically be scaled to fill the current frame size. For clips already imported prior to change, you can right-click and manually choose Scale to Frame on clips in your Sequence.
    Ideally, you should figure out what format you want to deliver, and start from there. For instance, if the final product will be on DVD, then 720x480 is the size to work with and you would start with a DV NTSC preset and scale clips to fit. Not a good idea to scale everything UP, as you will lose quality, so not recommending full 1920x1080 HD if your sources are all smaller.
    Also pay attention to FRAME RATE. You can mix them, but decide which one is most prevalent and that may be the one to use, depends though. If you can give examples of what you have to work with, and where it is going (DVD, YouTube, etc.) then you may get more specific tips
    Jeff Pulera
    Safe Harbor Computers

  • How can I remove multiple hyperlinks from a slab of text?

    Hi everyone,
    I copy a lot of text from websites into Pages documents, and I'm looking for a way to remove multiple hyperlinks from a slab of text all at once without having to remove each hyperlink individually? This would save me a lot of time!
    Not sure if Pages actually has this feature - if not then it would be a good feature request. It would be similar to MS Word's function to clear a slab of text of all formatting (including hyperlinks).
    Any tips would be much appreciated!
    Thanks,
    -Chris

    Select all the text concerned. Then:
    This will stop them being live links but they will probably be blue and underlined. Click the underline button twice, and use the colour selector to turn them black.

  • How can I get my site to diplay a blue or green site identity button? I have an SSL.

    A website I administer, hummert.com, shows a grey identity button, even on secure https pages. How can I get the blue or green buttons to display? I have a current SSL from Godaddy.
    Also, is there still supposed to be a lock icon in lower left corner on secure sites? I don't see it, even on bank of america's page.

    No, in Firefox 4 and later you no longer have the Status bar that showed the padlock in previous Firefox versions.<br />
    The padlock only shows that there is a secure connection and doesn't guarantee that you are connected to the right server.<br />
    So you might still be connected to the wrong server if you make a typo in the URL and someone has claimed that mistyped URL.<br />
    The functionality of the padlock has been replaced by the [[Site Identity Button]] on the left end of the location bar.<br />
    See also:
    * http://www.dria.org/wordpress/archives/2008/05/06/635/
    * https://support.mozilla.com/kb/Site+Identity+Button
    * http://www.mozilla.com/en-US/firefox/security/identity/

Maybe you are looking for