'group by' works good, but need another column

Hi,
I am seeking for better construction for next issue, this code is not good-readable and seems I can't add another column to returned output:
;WITH q AS (
SELECT srvs.description as srv, apps.description as app
FROM srv_link_app as link LEFT JOIN servers as srvs
ON link.srv = srvs.id
LEFT JOIN apps
ON link.app = apps.id
SELECT
FROM (
SELECT DISTINCT app
FROM q
) qo CROSS APPLY
SELECT CASE ROW_NUMBER() OVER(ORDER BY srv) WHEN 1 THEN '' ELSE '; ' END + qi.srv
FROM q qi
WHERE qi.app = qo.app
ORDER BY
srv
FOR XML PATH ('')
) qi(srv)
Works perfect, It connects 3 tables: apps, servers, link and groupy by column servers. So,
link table is auxiliary connection.
Output is:
app1 | server1;server3
app16 | server6;server13
It's good but I need add another column app.long_info, for example (Output):
app1|srv1;srv2;srv5 | app.long_info here

Can you post DDL? What little you showed us is a mess. You have a magic generic “description” that transform from servers to applications in violation of ISO-11179 Standards, logic and data modeling. Likewise, you have the classic noob “id” that also morphs
from servers to applications. I will bet it can be a squid or an automobile, too! 
>> So, link_table is auxiliary connection. << 
Auxiliary connections?? I never head that term before and I think been around SQL for awhile :). The term “link” comes from 1970's network databases. It was a type of pointer structure. Pointers connect, references do not. We would never use it in RDBMS. We
have n:m, 1:m or n:1 relationships and the relationships have real names. Using OUTER JOINs makes no sense. 
Next, I see you hate Dr. Codd and First Normal Form (1NF). You use XML to make the code hard to port, hard to maintain an unpredictable. Good SQL programmers write and do not do display formatting in the query.  This is the principle of any tiered architecture,
not just SQL. 
Here is my guess, with clean up: 
CREATE TABLE Applications
(app_id CHAR(12) NOT NULL PRIMARY KEY,
 app_description VARCHAR(25) NOT NULL,
CREATE TABLE Servers
(server_id CHAR(12) NOT NULL PRIMARY KEY,
 server_description VARCHAR(25) NOT NULL,
CREATE TABLE Application_Assignments
(app_id CHAR(12) NOT NULL 
   REFERENCES Applications
  ON DELETE CASCADE
  ON UPDATE CASCADE,
 server_id CHAR(12) NOT NULL 
   REFERENCES Servers
  ON DELETE CASCADE
  ON UPDATE CASCADE,
PRIMARY KEY (app_id, server_id),
Since we have no sample data, no sample output, we can only guess. But your terms an approach are completely wrong. Have read any book on data modeling or RDBMS? 
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL

Similar Messages

  • E1200 wireless works great, but needing another wireless router to hardwire connect to AVR

    I have an e1200 Linksys router hooked up and working well, a wired connection to my first computer a wireless connection to my second (laptop) in the basemen and to my HDTV. My question is what Linksys device would I need to enable me to get a wireless connection in the basement to then hardwire connections to my Blue-Ray player and my HK AVR-3650. Any advise would be a great help as in I have no clue on what I need, but again I would like to somehow take a wireless signal from one wireless router to another to then have wired connections from both wireless routers. Also, was the e1200 not the right router or can I still make something out of it? Thanks in advance - Ohio

    Aside from powerline adapters, you may consider as well WES610N. It is a wireless switch that you can connect to your home/main router to extend your existing network wired and wirelessly. It has 4 ethernet ports on the back for you to connect your wired devices to your network. For more information about this device, refer to these links: Expanding your home network using a WES610N Dual-Band N Entertainment Bridge, Linksys WES610N Frequently Asked Questions.

  • Hi, Someone Know why my charger is not working properly but always it was been working good but now when conect my iphone (3gs) shows a yellow triangle saying : Charging is not supported with this accessory. Please I need some help here. Thanks =D

    Hi Someone Know why my charger is not working properly but always it was been working good but now when conect my iphone (3gs) appears a golden triangle saying :Charging is not Supported with this accessory. Please I Need Some Help Here. Thanks =D

    sounds like the cable or the iphone connector are somehow damaged

  • Just want to say that's Block pop-up windows it's realy need to fix not work ever i think in Microsoft explorer it's work good but in firefox else new virsion Firefox4 it's not work right so please yts have to fix it it's so many important addon

    just want to say that's Block pop-up windows it's realy need to fix not work ever i think in Microsoft explorer it's work good but in firefox else new virsion Firefox4 it's not work right so please yts have to fix it it's so many important addon

    [Quote]
    Waiting for Tidbits and Elector to grace my post with there constant negativity and start a war of words as usual... since they love stirring the pot and angering the Windows Phone Community every time they reply to posts.  I just can't believe they spend that much time here on the forums replying if they are not a paid Verizon employee or a paid basher from a competing platform.
    [/Quote]
    Well I found nothing wrong in your post. So why even make a statement like the quote I included?
    Once more I am a retired government employee. So I have the time to post. Or has my rights been taken away to voice an opinion?
    Your posts was great you were not whining about your rights to file complaints to the FCC or FTC etc. One of the best I have read.
    And I am not trying to sway you from your phone choice. If you looked at my avitar it shows apple iphones. But I use and have used androids and not Windows phones.
    However your numbers of windows phone users all leaving over the issue is miniscule in the number of users of Android and iOS devices.
    I have written many times I wish all the devices get updated like iOS devices do. But at present that is not happening
    No bashing, no adversarial post just a little common sense is all I use.
    And again your post was great.
    Good Luck

  • My iphone 6 connects to the car via bluetooth, the music works good, but the phone calles does not work.  It looks like it is working but doesn't.  I have tried in my Hyundai and a Dodge rent car and get the same results.  I updated the last 8.0.2.

    My iphone 6 connects to the car via bluetooth, the music works good, but the phone calls does not work.  It looks like it is working but doesn't.  I have tried in my Hyundai Sonata and a Dodge Dart rent car and get the same results.  I updated the last 8.0.2.  It worked the first day i had the phone, and then i updated to Ios 8.0.2 and it quit working.
    Now when i get in the car, it acts like it is connected and makes the same call it was on after syncing to bluetooth, but it really isn't on a call.  This is happening on both cars.
    Does anyone know if this is the phone and i need to take it to Apple or if there is an issue that Apple is working on getting a fix for?
    My son in law has the exact same phone as me, we both got the on 10/6, he had a Dodge Dart and his is working via bluetooth.
    Someone HELP please, as i consider this a safety issue by not having my calls go to bluetooth.

    We had the same problem, but figure out the solution.
    You MUST have at least 1 song added to your ITUNE!  After you add a free song, then everything else should work as normal!
    Hope this helps!

  • I just bought the new HDMI cord for the IPad, it works good but a small potion of the TOP and the BOTTOM is cut off. It doesn't seem to do it for movies. My monitor is a 23 IN' acer s series.

    I just bought the new HDMI cord for the IPad, it works good but a small potion of the TOP and the BOTTOM is cut off. It doesn't seem to do it for movies(although I can't really tell. My monitor is a 23 IN' acer s series. I just installed the drivers for my monitor with no change. I think I have a CD somewhere for my monitor maybe it has some kind of program in there that can help me. I can post a picture if I need to. Thanks

    No work around that I know of.
    Apple Feedback http://www.apple.com/feedback/

  • TS3376 the application is working good, but the location of my device has found was totally wrong. any idea?

    the application is working good, but the location of my device has found was totally wrong. any idea?

    That would be the issue here.
    The gateway is a modem/router that is in charge of your network.
    The AirPort sensed this during setup and configured itself to operate correctly and passively with an "upstream" router on the network.....so, the Airport is in Bridge Mode.
    The upside is that the AirPort is configured correctly to work with your gateway. The downside.....and Catch 22....is that the Guest Network will not operate correctly when the AirPort is in Bridge Mode. 
    The AirPort has to be the router "in charge" in order for the Guest Network feature to work correctly.
    If you want to try to break some basic networking rules, and have two devices both trying to perform routing chores on the network, that might be a workaround.  But, things get complicated to set this up.....and it will produce what is known as a Double NAT error on the network......which may allows things to work OK....or....cause problems.
    Double NAT errors are unpredictable. It will be one of those things where you will not know if things will work until you try. No guarantees possible.
    The network will have to be completely redone if you want to try this, and you will have to set up new Static IP addresses for devices that need them.
    In general, if you want to try this, the network layout must look like this:
    Internet Connection > SMC Gateway > AirPort Express > Ethernet Switch > Devices.
    With things set up the way that they are now......the simpler thing to do would be to use the SMC wireless for your "main" network and the AirPort Express wireless for "guests". 
    The downside....."guests" will be able to "see" devices on your "main" network with this type of setup.

  • Is there any official market or store or anything in Egypt to fix my iphone 4 it jumped from 5th floor and the back hous was crashed and the network sensor was not working good but the phone and the screen and the others things are ok so plz help ???

    Is there any official market or store or anything in Egypt to fix my iphone 4 it jumped from 5th floor and the back hous was crashed and the network sensor was not working good but the phone and the screen and the others things are ok so plz help ???
    my iphone is now just coverd with case and the back house is crased

    Etisalat, Mobinil and Vodafone provide warranty service in your country.  You can also search Google for a 3rd party repair shop near you.

  • Radio group in classic report based on another column on the same row.

    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    Application Express 4.1.0.00.32
    How can I have a radio group column based on an LOV utilizing another column on the same row of the report?
    For example: what if I had a survey application and depending on the likert scale that was assigned to the question there would be different possible answer choices:
    Question 1 on row 1 of the report: The class instructor was friendly?
    Likert scale choice is Agreement.
    Choices on Radio Group: Strongly Agree, Agree, Undecided, Strongly Disagree
    Question 2 on row 2 of the report: The class offered good materials?
    Likert scale choice is Quality.
    Choices on Radio Group: Excellent, Below Average, Average, Above Average, Excellent
    The radio group can change per row depending on the Likert scale assigned to the question which is assigned to a different column on the row.
    Can LOV utilize the column? :
    SELECT scale_text
    FROM scale_choices
    WHERE scale_category_choice_id = 2 <<= this would be the Likert scale identifier
    ORDER
    BY display_order

    Here is the answer:
    APEX_ITEM.SELECT_LIST_FROM_QUERY(
    p_idx IN NUMBER,
    p_value IN VARCHAR2 DEFAULT NULL,
    p_query IN VARCHAR2,
    p_attributes IN VARCHAR2 DEFAULT NULL,
    p_show_null IN VARCHAR2 DEFAULT 'YES',
    p_null_value IN VARCHAR2 DEFAULT '%NULL%',
    p_null_text IN VARCHAR2 DEFAULT '%',
    p_item_id IN VARCHAR2 DEFAULT NULL,
    p_item_label IN VARCHAR2 DEFAULT NULL,
    p_show_extra IN VARCHAR2 DEFAULT 'YES')
    RETURN VARCHAR2;

  • MSI RS480M2 - works good - but not perfect ;)

    Hi ! I got a problem with my mainboard. I read that if i want to use Win 2000 (I got license so I didn't want to change my OS) I have to setup bios for SATA (RAID), to avoid pio mode error in win2k IDE driver. Of course it works very good, but.. the problem is when I use SATA mode - the bios splash (POST procedure) takes very long time. How to speed up POST procedure in SATA mode ?? In PATA mode POST takes 2-3 seconds - in SATA 15-20s. And the second question is ... how can I use SATA mode in WinXP x64 (I got 120 days beta from MS webpage) - there is no driver on ATI disk for x64. Is it possible ?? Now I'm doing bios setup to change from SATA (in w2k) to PATA (in XP64) everytime I want to boot. Is WinXP64 compatible with SiI SATA without drivers ? What do you think ?

    If you explore the download packages, there's a MakeDisk.txt with the following instructions on buidling the floppy:
       If you lost your Driver Disk labeled as "Silicon Image SATA RAID Drivers"
       This file will teach you how to make one Driver Disk
       First please perpare one formatted 1.44M Floppy
       Then please copy necessary driver from MSI Driver CD
    - Driver for Win2000/NT40/XP/2003
      Please copy CDROM:
      ATI\RS480\SBDrv\SATARAID
                               si3112r.cat  file
                               Si3112r.inf  file
                            Si3112r.sys  file
                            SiiSupp.vxd  file
                               SilSupp.cpl  file
                               SIWinAcc.sys file
                               TxtSetup.oem file
    Danno

  • I purchased an iPod touch 5 64gb mint condition, it was working good but now I reset it and it's asking for the Apple ID of the original owner. Does anyone know how to bypass this so it works for me?

    I purchased an iPod Touch 5 64gb mint condition, it was working great but I reset it and now it's asking me for an Apple Id. Problem is it want the original owners & not mine. I would have no problem contacting the person I bought it off of but I no longer have their information since when it worked I deleted the emails!
    Does anyone know how to bypass this problem so that I can have the ipod work for me and my Apple ID?
    I would even take it to Apple if they could fix it, would they? and what might that cost me?
    Any suggestions would be great!!!!

    Nope. Only the previous owner can do that. See:
    iCloud: Find My iPhone Activation Lock in iOS 7

  • TS3297 Unable to purchase on candy crush. I have purchased 5 lots at 69p but need another 5 extra moves or the money I've spent will be for nothing

    Please help. I have purchased exta moves on candy crush and now will not let me purchase more?

    Hi Ken,
    Wow, I've logged into adobe and never seen your response until now.
    I need to make the forums more of a daily stop I guess.
    Thank you for your response, When I go to the Archives, it states I have none. In addition, previously when I'd tried to move items to the archive, they just disappeared  
    Currently my desktop is not connecting at all, Everytime I connect, it's states "We have now logged you out" and requests I login again.
    I have of course rebooted,
    Gone into taskmanager, killed all the relevant threads,  tried again to login through the desktop, no luck, I'll have to uninstall it, make sure the threads are killed, then reboot it and then reinstall it, but I've not had the time to do that.
    On another note, and just as a point of reference, myself, personally, I hate these "cloud" file repositories (not to be confused with adobe cloud services which I love) but the file repositories themselves imho, are a blackhole of resource usage when one doesn't/isn't using them,
    Is there a way we can use it more of a "ftp" sort of thing, when I want to I can  put files there?  There is no way to "Download" the repository, no way to download the folders.. only individual files and then it takes I think three different steps before the download starts.. I find this very inhibiting.  Just an fyi. for what it's worth.
    Please, feel free to contact me,
    I'm on g+ chat [email protected]

  • My internet is working good, but when i open facebook it goes totaly down. my facebook is too slow

    l have only one problem that is facebook is not working well

    Hello,
    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • My HP 3840 Series Deskjet Printer was working good,But suddenly stop working . Asked me yesterday t

    Asked me yesterady to Uninstall then contact the HP customers service.
    Now what do i need to do,I use rarely computer/printer.

    Please read this postthen provide some details.   What operating system? Are there any error messages on the computer screen or blinking lights on the printer?  
    Running the diagnostics at http://www.hp.com/go/tools may help resolve the issue.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Showing contents of a column based on a condition for another column.

    Hello,
    I am trying to create a report that lists all of the Opportunities within our database. I need a few details about this opportunity to appear. I need the account name that this opportunity belongs to, amongst other things- which I can do, however I also need to show the number of UNITS for this opportunity BUT I have a condition that needs to be met before I show the number of units.
    I only want to show the UNITS IF the PRODUCTTYPE that this opportunity belongs to is "GA". Then I also need another column with UNITS in it, but again I only want the UNITS to appear if the PRODUCTTYPE IS DA.
    Essentially I am trying to find out the number of units per product type and I need these to appear in separate columns. If the PRODUCTTYPE doesn't meet the condition, i.e. the PRODUCTTYPE is not GA then I would like the field to be blank.
    I know that I should write this formula in the "Edit Formula" of the UNITS field, but I do not know how to write this condition.
    I would very much appreciate some help as soon as possible.
    Kind Regards,

    Hi,
    You need to use a case statement, it looks like this:
    CASE
    WHEN opportunity.producttype = 'GA'
    THEN opportunity.units
    ELSE NULL
    END
    Ofcourse you need to use the correct column names.
    Regards, Tim

Maybe you are looking for

  • ITunes 7.3.2 (OSX) and 5th Gen iPod not synching

    I have had my 5th gen iPod (30GB) for about 2 years now and originally had used it with Windows, then I switched over to a Mac in Feb and have been pretty happy. Normally i synch my iPod daily to get my playlists updated (so I don't listen to the sam

  • Creation of ASM disk for OUI

    I need to install a Oracle Database in order to install Enterprise Manager Cloud Control 12c. Need the database to use a ASM disk. I used the following command to create the disk, per the Oracle Database Installation Guide. #/usr/sbin/oracleasm creat

  • How do i transfer jpg files from outlook to iphoto

    how do I transfer multiple .jpg files from outlook to iphoto very easily?

  • BAPI for post Tax Amount

    Hi, Please tell me BAPI for post Tax Amount. Which tcode use for Post tax code, is it FB01 or FB60. Regards Jana

  • IWeb sitemap and Google search

    I'm sorry, I mistakenly formerly entered this topic as a post on a previously answered question regarding Google Keywords. I have more questions on this topic. I have two questions: 2. I have .mac and am using domain forwarding. I obtained and follow