Help please on advanced MySQL...

Dear all:
Sorry for posting some MySQL-related topics here, which neverthess is a portion of a Java intensive project =) I tried to ask for some help on MySQL forum but it seems here would be more gurus on MySQL!!
Basically I need to do some manipulation on an existing table, with the task detailed as follows:
For each pairwise rows/records in a table which have disparate values on the same attribute/column, say A, check and then record (to be passed on and computed later in Java environment) all column names with identical values in these two rows. For example, suppose the table is like: A  B  C  D        <-- Field/Column Names
a1 b1 c1 d1
a2 b1 c2 d1
a2 b2 c1 d2 Then
(1). consider row1 & row2, which have different values on A, they coincide on column B and D, so 'BD' needs to be recorded;
(2). consider row1 & row3, which have different values on A, they coincide on column C only, so 'C' needs to be recorded.
So as for column A, {BD, C} is the wanted answer.
What Im planning now is just join the table with itself, specifying different values on A. Something like: SELECT [column name/s??] FROM theTable t1, theTable t2 WHERE t1.A <> t2.A AND
[some value comparisons on B, C and D, respectively to find out which one/s(column name/s) should be recorded] Any help is welcome & many thanks in advance!!
Frank =)
P.S.: I feel that there should be a way to do some computation within MySQL, but just cannot find the way to it!! Althernatively, the computation may be done in Java but this would cause a big performance degradation since it incurrs enormous information passing between Java & MySQL via JDBC.

Thanks very much for your reply!! =)
Sorry for not making the question a bit clearer.
So, for every pair of rows (or a subset of all thepairs?), you need to extract which columns match on
that pair
First of all, I need to look at each attribute once
at a time; the example in my 1st post was for field A
(subsequently I need to examine B, C, D one after
another)
When looking at a field, again let's say A, I need to
elicit ALL pairs of rows which have DIFFERENT values
on A, i.e. t1.A <>t2.A, and then compare if both have
the same values on any other columns; if so, record
the column names. However I cannot specify 'AB' in
the SELECT clause, since there's no way to find out
their values coincide on 'AB' prior to computation.Unless I'm totally missing the point, yeah, there is. The where clause tells us that they will coincide on exactly AB.
You need separate queries for each combination--one query for 'A', one for 'AB', one for 'AC', etc.
If you don't want to do that, you'd have to grab each pair of rows, and then basically do a bunch of if tests (or generate a map or something) to see which fields match. I don't know if you can do that in SQL or not. I suppose you could in a stored proc, but I wouldn't know how.
In Java it's easy, but it requires either storing the entire table in memory or making many trips to the DB.

Similar Messages

  • Help with an advance mysql query

    I'm using CF 7 to query a MySQL 5 DB.
    I was wondering if it's possible to add an OR operator in a
    subquery or at the end of a conditional statment. Let's say that in
    my conditional WHERE statement after a few inclusive conditions, I
    wanted to add an "AND & OR" logic.
    maybe by including part of my code I can be a little more
    clear:
    <cfquery name="domysearch" ...>
    SELECT
    a.id as id,
    b.company as company,
    c.add_line1 as add_line1,
    FROM registratn_contacts a, registratn b,
    registratn_addresses c
    WHERE a.owner = #arguments.owner#
    AND b.id = a.master_record
    AND c.id = a.address_id
    AND c.state = 'NY'
    OR c.state = 'CA'
    I would like to know if I can or should accomplish this in my
    query or if I should have this logic outside the query?
    Thanks for any help!!!!
    Carlos

    WHERE .....
    AND (c.state = 'NY' OR c.state = 'CA')
    You can use an OR, but it is probably
    better to use an IN clause, as it is essentially an OR, and
    would be more efficient.
    AND c.state IN ( 'NY', 'CA')
    Phil

  • I made a dumb decision to 'Erase Free Space' on my drive. I now have no free space, I realize because it wrote 0's over all my free space. Is there a way to undo this??? Help please I can't save any documents now! Thanks in advance all, it is truly apprec

    I made a dumb decision to 'Erase Free Space' on my drive. I now have no free space, I realize because it wrote 0's over all my free space. Is there a way to undo this??? Help please I can't save any documents now! Thanks in advance all, it is truly appreciated. how can find the hidden temporary files using the terminal what do i type in?

    It's more likely a failed Erase Free Space, which creates a huge temporary file; that's why it looks like you have no more available drive space. You can recover from this. See these links
    https://discussions.apple.com/message/10938738#10938738
    http://www.macgeekery.com/tips/quickie/recovering_from_a_failed_secure_erase_fre e_space 
    Post back if you need any help with this.

  • Why I can't change on the settings ,I cloud ,advanced l, mail and then email address there I can't change ? Help please

    Why I can't change on the settings ,I cloud ,advanced l, mail and then email address there I can't change ? Help please?

    You can't change that address by design, but Apple allows you to create another two addresses and use instead they call those aliases and you can create and use those different for different people with the same account. Instructions here
    http://support.apple.com/kb/ph2622

  • My ipod touch 4th generation won't synch.i'm trying to put a pdf file on it.please help thanks in advance...

    my ipod touch 4th generation won't synch.i'm trying to put a pdf file on it.please help thanks in advance...

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try on anoterh computer to help determine if you have an iPod or computer problem.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
      Apple Retail Store - Genius Bar

  • I am running acrobat 7.0 pro - my hdd recently crashed without warning - i am now unable to re-activate my acrobat 7.0 pro - help please...thanks in advance.

    Hello - I am trying to re-activate my acrobat 7.0 pro on my new hdd after my old hdd crashed. Can anyone help: thanks in advance ...russ22

    Hi russ22,
    There's a lot of that going around lately (hard drive crashes). Sorry to hear that!
    It sounds like you've reached the maximum activations allowed, and because your hard drive crashed, of course you can't deactivate the copy that was installed there. But don't worry--Customer Care should be able to take care of that deactivation for you. Please Contact Customer Care.
    Best,
    Sara

  • I get error message "unknown error" When trying to log on to itunes via pc, help please!

    I get error message "unknown error" When trying to log on to itunes via pc, help please!

    Hello, trolle56.
    Thank you for the question.  You may find these articles helpful in troubleshooting the error received with the iTunes Store. 
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    iTunes: Advanced iTunes Store troubleshooting
    http://support.apple.com/kb/ts3297
    Cheers,
    Jason H. 

  • 'Error loading plugin: Plugin file not found' message on ONLY 5 sites, but all others OK.  Help, please!

    Hi Again!
    I posted this problem here before, but since I really need to access the sites that receive this error message in less than a month, I had to re-post; hopefully someone who didn't see it before will see it & have a solution for me.
    Here are the details:  I'm running windows 8.1 & I use Firefox 33.1.1, Pale Moon 25.1.0 or Opera 26.0 as my browsers, (I have IE installed & up-to-date, but I never use it).  I followed the 10-point checklist on Adobe & everything was done, except for "uncheck Hardware Acceleration" in Flash 'Settings'; I tried to uncheck it on this site, where it's indicated, as well as in my 4 browsers when I'm doing something that uses Flash, but no matter how hard I try, I can't 'uncheck' the check mark in that tiny box!  Since this error problem only affects 5 web sites, & I can watch streaming media on all other sites, I don't think it's an issue. 
    Here's how this problem began:  I was watching a live, streaming nest-cam on 5/09/14 around 11:00AM, (yes, I DO know the exact time & date, because it happened so suddenly while I was watching this website that I'd been watching since the end of February, 2014), when my screen went black.  I thought it was probably an Adobe Crash, but when the usual Crash Report window didn't show up, I just closed Firefox & reopened it, expecting to resume watching the nest-cam.  When I went back to the site, I got the black screen with the "Error loading plugin: Plugin file not found" message.  The chat portion on the site still works, though. I know there are other sites with this nest-cam feed, so I started trying them, but it took several tries for me to find one that didn't get the error message! I posted this problem on "Windows BBS" forum, & someone else posted that the same thing happened to them AND on the same sites!  They didn't have a solution, either.  I cleared my cache, rebooted my PC & even did a System Restore, but whatever happened in that brief second made using ONLY 5 sites impossible.  Here are the sites that receive the error message:
    http://pixcontroller.com/eagles, (but I CAN go to http://pixcontroller.com, but there isn't any streaming media)
    http://cbslocal.com/eagles
    http://westmorelandconservancy.org/BlueBirdwebcam-1.htm
    http://wildearth.tv/cam/pittsburgh-bald-eagles, (I get the error message on ALL cams on this site)
    http://aviary.org/BE-NestCam1 (I get the error message on ALL cams on this site)
    Now if any videos from the 5 websites above are uploaded to YouTube, I can watch them perfectly...no error message if I watch the videos elsewhere.  Luckily, I found Ustream, & they have most of the nest cams I watch, but I need to fix this issue, because it's nearing nesting time!  I'm an amateur nest-watcher & it's vital that I have access to these 5 sites, so if anyone knows how to fix this, PLEASE tell me!
    Thanks for taking the time to read my post.
    All suggestions/solutions are gratefully accepted.
    Thanks in advance for your help!
    DogPal 

    File Not Found Error in Welcome Screen
    07-Nov-2013 10:25
    Tags: #dreamweaver_cs6_update
    Help please!
    Live preview also not working.
    I have exactly the exact problem described below but do not have a folder with the same name as the volume created under the volume. Please can someone help - I've tried everything. This problem only happened when I upgraded to Dreaweaver CC!
    "On launching Dreamweaver on your Macintosh if your Welcome Screen is not loading and if you see a "File not found" error, please check if you have a folder with the same name as your volume created under the volume. For more info on this please go through the attached pdf document. Other dialogs/panels in dreamweaver that will be blank due to this issue are Jquery Swatches panel, Adobe Edge Webfonts tab in Manage Fonts dialog,W3c Error Info dialog, Externalise Javascript dialog and svn revert dialog. After following the changes mentioned in the attached document please check all the affected dialogs/panels to confirm everything is working as expected."
    Thanks,
    Martin Bond
    [personal information removed by moderator]

  • Safari 5.0.6 repeatedly crashes.  MacBook Pro 10.5.8  I've emptied cache and reset to no avail.  I've tried solutions found in other threads.  Help, please.

    Safari 5.0.6 repeatedly crashes.  MacBook Pro 10.5.8  I've emptied cache and reset to no avail.  I've tried solutions found in other threads but the more advanced don't seem to apply to me. Help, please.

    Not sure what other tests they could run for me. I've pretty much run all the tests I can using Drive Genius and Tech Tool Pro 5. Is there anything they use that I don't know about??

  • Help please! Restore Backup deleted my most recent data

    Hi,
    Desparately need help please!
    I accidentally deleted a note that was quite important, though not the end of the world if I lost it. Then I looked at iTunes and there's the 'Restore Backup' button under 'Backups'. So I thought, OK why don't I try click that and see if the note is in the back up.
    But after clicking it, without asking for confirmation it just went ahead and restored my iPhone to a very old state. So my recent photos, notes, etc, now all disappeared! Only the apps appear to be merged - so my recently deleted apps came back and my existing ones are still there as well. I was hoping for the notes and photos the restore process would do the same but apparently not.
    Is there any way I can revert this restore process so I can go back to the state before I did the restore?
    Thanks in advanced for any help.

    Just update your replacement phone to the latest iOS in iTunes.  (Connect it to your computer, open iTunes, click on the name of the phone in iTunes, go to the Summary tab of your iTunes sync settings and click Check for Update.  You may receive a prompt when you launch iTunes that an update is available; if so, update from there.)  When given the options, set it up as a new iPhone.
    Then eject it from iTunes, disconnect it from your computer, go to Settings>General>Reset, tap Erase All Content and Settings, go through the setup screens and when given the option, choose Restore from iCloud Backup.  You should be able to restore from your backup now.  Be sure your phone is connected to wifi and your charger and this will take some time to finish.

  • For some reason I cannot download and install the latest version of iTunes. 11.0.2. Could you help please? Each time I try, I get a command box saying 'The feature you are trying to download is on a network resource that is unavailable. Click Ok to try ag

    For some reason I cannot download and install the latest version of iTunes. 11.0.2. Could you help please? Each time I try, I get a command box saying 'The feature you are trying to download is on a network resource that is unavailable. Click Ok to try again or enter an alternate path to a folder containing the installation package iTunes.ms in the box below.
    Please help!
    Many thanks in advance
    Ben Bentley
    West Midlands
    UK

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • HP MediaSmart Connect x280n AC Adapter HELP PLEASE!

    HP MediaSmart Connect x280n AC Adapter HELP PLEASE!
    Please someone tell me where I can get an AC for this unit and if not, please tell me the part number of this AC Adapter if you own one of these please? I have iterally looked for over 15 hours the past 2 days and called HP only to be passed on from department to department with not one clue as to this part number or where I can obtain an adapter for my unit. I found only 2 on ebay that had visible markings on the AC in the pics but could make out neither of their text.
    Thanks in advance for any help.

    Did you ever get an answer to this question?
    I'm about to be in the same situation, and have been trawling the web to try to find a specification for the power supply.
    I can see that the unit requires 19V at 22W, but that's all.
    I don't know the size of the DC connector that is required.
    Thanks!

  • HELP PLEASE- ON A DEADLINE

    Hi- I'm working with some HDV media in a ProRes 422 HQ sequence and while the picture looks great on my computer but when spitting it out via my Canopus box to a TV I'm getting a horrible looking picture (my final output will be DVD). Looks like interlacing jumps. Don't understand why this is happening. If I run a de-interlace or flicker filter on top of it, it looks really fuzzy. Here are the specs on my media:
    29.97fps
    1440x1080
    HDV 1080i60
    3.2 MB/sec
    HD (1440x1080)
    Upper (Odd)
    Someone please help, thanks in advance.

    Yes, the only reason being I didn't want to re-render the whole thing in DV. Actually when I try just a portion of it in a DVD timeline and render that, the Canopus will only spit out the first frame and then the frame it parks on when I hit stop- "Refresh A/V Devices" isn't helping.
    The Canopus will spit out ProRes on the fly- but again, I'm getting the problem I described.

  • Excel sumifs and the powerpivot version help please

    very new to power pivot, can you help please?
    In an excel table I was able to do the following...
    =SUMIFS([GWP],[Date],[@Date],[PolType],[@PolType])
    I have 60k rows where the above totals all GWP where the date & policy type match the individual record.  This in effect gives a subtotal, per date per policy type rather than doing it in a pivot table.  This works
    nicely however it takes for ages to update, and calculate, also has issues when I then need to pivot table it.
    As a result I'm trying to use powerpivot, as I understand it is better at dealing with these big calculations, I've tried the calculate formula, but I cannot understand how to have a rolling criteria in the field.  Like I can in my sumifs.
    Thank you in advance for your help
    Mathew

    To duplicate your original SUMIF as a Calculated Column in PowerPivot you could use one of the following:
    Using EARLIER():
    =CALCULATE(
    SUM(Table1[GWP]),
    FILTER(
    Table1,
    Table1[Date] = EARLIER(Table1[Date]) &&
    Table1[PolType] = EARLIER(Table1[PolType])
    Using ALLEXCEPT:
    =CALCULATE(
    SUM(Table1[GWP]),
    ALLEXCEPT(
    Table1,
    Table1[Date],
    Table1[PolType]
    Both should produce the same result as a Calculated Column.
    The second version with ALLEXCEPT() should also work a Measure/Calculated Field:
    ALLEXCEPT Measure:=
    CALCULATE(
    SUM(Table1[GWP]),
    ALLEXCEPT(
    Table1,
    Table1[Date],
    Table1[PolType]
    The advantage of the measure is that it should return the expected result in a pivot and filtering dynamically.
    Your final measure would then be:
    Percent GWP:=
    SUM(Table1[GWP])/[ALLEXCEPT Measure]
    In all examples, replace 'Table1' with your actual table name in Power Pivot.

  • Help Please! Offline Clips!

    Ok here's my problem. I am using a clip of green screen footage that I have keyed out with two different backgrounds that I want to eventually layer on top of each other. Basically, it is the same clip on top of itself but with two different backgrounds. I can't keep them as is in the timeline because of the green screen effect. I got the clip with background 1 and exported it as a quicktime movie to my external hardrive. I then got the same clip, removed background 1 and inserted background 2 then did the same export process. I then imported the files back into fcp and they're fine for about ten minutes and then they turn white, as if they are offline. When I try to reconnect the media it says that they are online. Not only that, but they are unrenderable. I've tried this process many times and every time it's the same result.
    Does anyone know what may be causing this problem and how to fix it?
    G5

    Because it is a green screen clip, once I key it out anything I put under it will show up. It's basically a clip with a still image behind it. I want the same clip with two separate images behind it. If there is an easier way to do this then please let me know. I'm not really that advanced with the software.
    I also get this error message when re-booting"
    The movie file "help please-FIN-00000001" cannot be found. Without this file, the movie cannot play properly
    The name of my sequence that I exported the files on is labeled "help please"
    Make any sense?

Maybe you are looking for

  • DataGrid not reflecting changes after INSERT into Table. Delete from Table does.

    Wow, it's been a while. Hope you guys can help. This is my DataGrid: <DataGrid DataContext="{StaticResource TableAssetsViewSource}" ItemsSource="{Binding}" x:Name="TableAssetsDataGrid" AutoGenerateColumns="False" EnableRowVirtualization="True" Margin

  • How do I stop iTunes from automatically importing the songs I download?

    I usually end up deleting a bunch of songs, but iTunes is automatically importing/adding the songs I download which then creates a lot of missing file links. How do I stop iTunes from doing that, I just want to be able to add them manually by folders

  • Fx 5200 - Tdr128

    hello all guys....have a problem....: when i setup the driver of nvidia any one.....after i restart it my computer appear a black screen to me but when i uninstall it it's work ....screen apear normally....but when the screen apear black if i restart

  • Consolidating Different User Libraries in Windows XP

    We have 2 separate users accounts set up in Windows. A lot of the music is duplicated under each user. I would like to consolidate both libraries into one to save space and delete completely the second user account as this is all the second user is s

  • 1552 AP failing to join WLC

    Hello All, I am having difficulty joining a 1552 AP to the 5508 WLC. I am using the 3750 switch attached to the WAP as a DHCP server for the AP points. The AP obtains a IP address from the DHCP server, however fails to join the WLC. i can telnet to t