SELECT DISTINCT does not work - Another Problem!

Dear All
Previous Post
I just posted a thread, which has been answered by an expert. It's here:
SELECT DISTINCT does not work. Why?
My original problem was that the Query returned duplicate records, and SELECT DISTINCT did not work.
The solution was to change this select:
T0.[U_SupInv]      AS 'Link'
... to this:
CAST(T0.[U_SupInv] as nvarchar(100))      AS 'Link'
The amended Query worked.
New Problem
I just discovered that resolving the problem created a new one.
The field U_SupInv (Link) is in fact a UDF.
I created it so that all Suppliers' Invoices could be Scanned to pdf files, and these pdf could be linked
to the respective AP Invoice.
Originally, when I clicked 'Link' in my Query results, the pdf scan pops up.
When the Query is amended by adding CAST, the link becomes dead.
Help
Could anyone tell me how I can make SELECT DISTINCT work, as well keeping the LINKS live?
The main purpose of my Query is to help users view the pdf scans by clicking on the links.
Thanks
Leon Lai
Here's my Original Query
SELECT
T0.[UpdateDate] AS 'Update Dt',
T0.[TaxDate] AS 'Doc Dt',
CASE T5.[TransType]
     WHEN '18' THEN 'PU ' + CONVERT(VARCHAR(6), T0.[DocNum])
     WHEN '19' THEN 'PC ' + CONVERT(VARCHAR(6), T0.[DocNum])
END 'SAP Ref.',
T1.[ImportLog]     AS 'Ship #',
T0.[CardCode] + '' AS 'Supplier #',
T0.[CardName]      AS 'Supplier Name',
T0.[DocTotal]      AS 'Rs',
T1.[BlockNum]      AS 'Reqn #',
T0.[DocNum]        AS 'Doc No',
T0.[U_SupInv]      AS 'Link'
FROM klship.[dbo].[OPCH] T0
INNER JOIN klship.[dbo].[PCH1] T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN klship.[dbo].[OJDT] T5 ON T0.[TransID] = T5.[TransID]
WHERE
(T0.[UpdateDate] >= '[%2]' AND
T0.[UpdateDate]  <= '[%3]' AND
T0.[U_SupInv] IS NULL)
OR
(T0.[UpdateDate] >= '[%4]' AND
T0.[UpdateDate]  <= '[%5]' AND
T0.[U_SupInv] IS NOT NULL)
FOR BROWSE

Dear István Korös,
Thanks a lot for your answer.
I will test your suggestion tomorrow, as it's night and I am returning home now.
However, I do not think it will suit my requirements for the foll reasons:
- I worked hard to get rid of the need to enter anything in the @Scan2 field.
- This UDF was created solely as a text of instruction for my staff.
   Unfortunately I had to fill in something to make the Query work.
- The problem is that if the user forgets to click the drop-down arrow and leaves @Scan2
   blank, the query does not work.
- With the help of another expert, I succeeded in ignoring @Scan2 altogether.
- I posted only a simplified version of my Query on the forum, without the codes relating to eliminating the
  need to enter something in @Scan2, so you may not be aware of my requirement.
- I hope you understand my reluctance. But I will try your suggestion nevertheless.
My Suggestion
I think using PCH1.VISORDER may be the solution.
If we select only those rows where visorder = 0, then
   - there will be no duplication
   - I need not use SELECT DISTINCT
   - All my LINKS to pdf files will be live because I need not use CAST
   - I may retain that part of my Query which permits ignoring @Scan2 altogether.
- A Dream!-
The problem is that I don't know how and where  to place that VISORDER.
If you think I may be right, could you help me along that line?
Best Regards
Leon Lai

Similar Messages

  • SELECT DISTINCT does not work. Why?

    Dear All,
    I wrote the Query below in SAP B1 8.8 and it works fine.
    But, for some strange reason, certain records are duplicated.
    Could anybody explain why?
    I tried to eliminate the duplicates by changing the 1st line of the Query from SELECT to SELECT DISTINCT
    Error Message:
    The ntext data type cannot be selected as DISTINCT because it is not comparable.
    Could you help amend the Query?
    Thanks
    Leon Lai
    SELECT
    T0.[UpdateDate] AS 'Update Dt',
    T0.[TaxDate] AS 'Doc Dt',
    CASE T5.[TransType]
         WHEN '18' THEN 'PU ' + CONVERT(VARCHAR(6), T0.[DocNum])
         WHEN '19' THEN 'PC ' + CONVERT(VARCHAR(6), T0.[DocNum])
    END 'SAP Ref.',
    T1.[ImportLog]     AS 'Ship #',
    T0.[CardCode] + '' AS 'Supplier #',
    T0.[CardName]      AS 'Supplier Name',
    T0.[DocTotal]      AS 'Rs',
    T1.[BlockNum]      AS 'Reqn #',
    T0.[DocNum]        AS 'Doc No',
    T0.[U_SupInv]      AS 'Link'
    FROM klship.[dbo].[OPCH] T0
    INNER JOIN klship.[dbo].[PCH1] T1 ON T0.[DocEntry] = T1.[DocEntry]
    INNER JOIN klship.[dbo].[OJDT] T5 ON T0.[TransID] = T5.[TransID]
    WHERE
    (T0.[UpdateDate] >= '[%2]' AND
    T0.[UpdateDate]  <= '[%3]' AND
    T0.[U_SupInv] IS NULL)
    OR
    (T0.[UpdateDate] >= '[%4]' AND
    T0.[UpdateDate]  <= '[%5]' AND
    T0.[U_SupInv] IS NOT NULL)
    FOR BROWSE
    Note: -  U_SupInv is a UDF used to attach a scanned pdf file to the Supplier's Invoice.

    Dear István Korös,
    Thanks a lot for your answer.
    Your suggestion works!
    I am closing this thread.
    However, I have never met the problem of duplicate records before
    with such straightforward Queries.
    If you could explain to me why such duplicates arose, it would be very
    satisfying.
    Best Regards
    Leon Lai

  • Multi-select LOV does not work in forms

    the multi select LOV does not work in the form.
    the LOV works individually but in the form it does not work. it does not allow multiple selection from the list.
    is there a workaround for this or is this a bug ...?
    any ideas ...?
    thanx a lot.
    null

    Right, we cannot store more than one value in a single column in a table :), we were getting a lot of requests to support multiple select LOVs but requirements were contradictory if not mutually exclusive.
    The only sense it makes is when used together with user-defined object types (nested tables for example) but the current [application building]infrastructure we have does not support this. However, we are looking into this and this feature maybe implemented in a future release.

  • Double click select all does not work in web site's search area after going back.

    After updating from Firefox ESR v24.8.1 to v31.20 double click select all does not work in a search area after going back or searching again with the same input. It happens before clicking search icon and searching for something else double click select all does not work except it works for one word that's all.
    This issue is with all new Firefox ESR and None ESR I have tried. Also the issue is on all web sites like www.softpedia.com for example.

    Bugzilla has a different login system, unfortunately.

  • Zen Micro 5gb - Playlist on the fly with "add to selected" often does not work (AD HOC 'playlis

    I've found ad-hoc playlist made from ADD TO SELECTED often does not work. Here are other issues:?. Does not add? at all OR only adds after first song selected played2. Cannot swith from ARTISTS to SONGS w/o killing list. This will kill the ongoing list.3. If I make mistake and hit the PLAY button, it wipes out the entire list I'd already made. Any of these issues resolved in Zen Vision M?

    try reloading the firmware and if that doesnt work try opening the case and cleaning it if there is anything in there. the button may be stuck. and if that doesnt work i dont know what else to sugjest. it seemed to work for me.

  • Dictionary and selecting words does not work for Japanese documents

    iOS 5 includes both English and Japanese dictionaries. However, it seems that dictionary function does not work for Japanese PDF documents, nor can I select any Japanese words in Adobe Reader. Please fix this!
    Thanks,
    Kenny

    You can start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).<br />
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.<br />
    You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.<br />
    You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")<br />

  • Added field to dynamic selection screen does not work in FBL5N

    hi,
    we have added KNA1-KATR5 to the selection screen of FBL5N by using logical database DDF using "view CUS" but it does not work.
    Our system is 6.0
    is there any OSS note or program that we should add?
    many thx.

    Refer This:
    Additional field selections in FB03

  • Selection Tool does not work

    Hi, everyone, I noticed that the Selection tool (V) does not work properly, I use Ai CS3, and I can`t resize,move or select any object or text, Can anyone help me?
    Thanks a lot
    Diana

    Sounds like "Preferences>Selection & Anchor Display>Object Selection by Path only" is on.

  • When i paint either black or white on layer mask it erases picture pixels also path selection tool does not work

    when I paint either in black or white on layer mask it erases picture pixels also path tool does not work

    I would try resetting your preference file first:  http://www.lightroomforums.net/showthread.php?14226-Resetting-(or-Trashing-)-the-Lightroom -Preferences-file
    Also, install the latest version 4.4.1 would probably be a good idea.

  • Select button does not work

    I have a Classic Ipod 60G and I have almost 6,000 songs on it. I also have my contacts from outlook and my photos from Adobe Photoshop. It is only half full. It is stuck on "songs" and I cannot choose the music I want to hear and I cannot access my photos, settings, contacts, etc. I've upgraded Itunes automatically and am currently on Version 10 and my music is synced with Itunes and any new music automatically downloads to my Ipod. But cannot hear them because my select button will not click to change from songs to "playlist or artist". What do I do? My old Ipod, a 15G classic has no problem, but my newer 60G has a stuck program or a stuck button. Which is it?

    I also had the same problem. After reading many suggestions on how to fix, I tried the one that seems to work for many people.  I plugged my apple tv into my pc ( itunes) and it automatically asked if I would like to restore it and  that it will download any updated software.  I followed the instructions and when it was complete I tried it out and it worked perfectly. When Apple TV is plugged into your pc it does not need any power. Also you need to use a micro usb to connect it.  Hope this will help!
    There was a problem for a short while (see link below) but as of a few days ago you no longer have to do anything special to update the Apple TV2 since Apple released v4.4.2.  All you need to do is go to Setttings > General > Update and it will automatically update to v4.2.2 from any earlier version.
    http://support.apple.com/kb/TS4107

  • Select tool does not work

    Select tool has quit working.  Click on it and the snap shot tool appears.  All other tools work fine.  Uninstalled and reinstalled reader but problem remains.

    The Selext Tool works only on actual text; on a scanned document when it has been treated with OCR.
    Or does the same thing happen when you do it on a text document like http://helpx.adobe.com/pdf/adobe_reader_reference.pdf ?

  • SELECT statement does not work if characters ## are contained in field

    Hi Experts,
    I have the following statement:
    select single field1
        from table1
        into var1
        where field2 = text.
    This is a very simple statement that is working for me almost always correct. However there is a situation where the system is not able to find the record in my table. If text is equal to JAN##2011 the system won't deliver a result even if I have an entry in table1 with exactly this value.
    TABLE1
    field1 field2
    rome JAN##2011
    paris JAN2011
    only if text is JAN2011 the select will find a result.
    all fields are defined as CHAR.
    Thanks in advanced

    Hi Alberto,
    probably ## is not ## :-).
    is the visible representation used by ABAP to show any non-displayable characters as control characters like TAB, CR, LF, FF and the like.
    In debugger you can switch to HEX display of values, if you see something like 0A0D you can find this using CL_ABAP_CHAR_UTILITIES constant attributes.
    Regards
    Clemens

  • I have an image sequence in JPG and when I select open image sequence, select all does not work and I can only highlight one frame at a time.  I want to import these frames into QT7 to make a time lapse clip.  Any suggestions

    I have an image sequence in JPG that I want to import into quitck time 7 for making a time lapse clip.   It has an option to open the image sequence, but when I do, it only lets me highlight one frame at a time.  The select all option seems to do nothing when I click on it trying to highlight all the frames. 
          If QT7 is not designed to perform this function, is there another alternative?   iMovie is non intuitive for this kind of operation and I cannot find a clear tutorial for using it to make time lapse clips from a sequence of still frames.  
           The tutorials Ive found on YouTube are well intended, but they all seem to leave out a vital step that eludes detection.  
      Anyway, any help appreciated. 
    Thanks
       I am new to this forum and I'm not sure I can locate this thread again once I'm out of it.
    <Email Edited by Host>

      Yes, I tried that.   The files were ordered by their original numbers as imported from the camera, but I batched them through Phocoshop to downsize all of them into a more manageable file size.   I opened that destination folder from quick time  from where it said select image sequence.   I clicked on the first one and opened it.   The result was a large image with an arrow indicating a movie was ready to go.   When I pressed the arrow, though, I realized it had only imported that one frame so there was no movie.   The files are Jpgs and are about 450 KB each. 
        To your knowledge are there any links to iMovie tutorials or quick time tutorials that may address this situation?  Maybe there will be one I haven't looked at yet. 
        Thanks

  • The arrow select tool does not marquee

    The arrow select tool does not work properly.  At times it marquees and some other times it doesn't.
    Please help.

    Judy,
    Has it worked with Yosemite before?
    Did you upgrade to Yosemite, then reinstall? That is the recommended way/order.
    Especially if the tool has just stopped working, there may be some kind/level of corruption/disturbance, and you may try the list.
    The following is a general list of things you may try when the issue is not in a specific file, and when it is not caused by issues with opening a file from external media, see below. You may have tried/done some of them already; 1) and 2) are the easy ones for temporary strangenesses, and 3) and 4) are specifically aimed at possibly corrupt preferences); 5) is a list in itself, and 6) is the last resort.
    If possible/applicable, you should save current artwork first, of course.
    1) Close down Illy and open again;
    2) Restart the computer (you may do that up to at least 5 times);
    3) Close down Illy and press Ctrl+Alt+Shift/Cmd+Option+Shift during startup (easy but irreversible);
    4) Move the folder (follow the link with that name) with Illy closed (more tedious but also more thorough and reversible), for CS3 - CC you may find the folder here:
    https://helpx.adobe.com/illustrator/kb/preference-file-location-illustrator.html
    5) Look through and try out the relevant among the Other options (follow the link with that name, Item 7) is a list of usual suspects among other applications that may disturb and confuse Illy, Item 15) applies to CC, CS6, and maybe CS5);
    Even more seriously, you may:
    6) Uninstall (ticking the box to delete the preferences), run the Cleaner Tool (if you have CS3/CS4/CS5/CS6/CC), and reinstall.
    http://www.adobe.com/support/contact/cscleanertool.html

  • My multisim simulation does not work in real world

    Hi
    I am new one to the circuit world.
    MY project is electric field measurement in thunderstorm. So I have plat plate antenna working as big capacitor and I need amplifier with high gain 500-1000) to amplify the signal I create the circuit but the problem is when I create in real world it does not work
    Other problem is to reduce the DC offset I put the high pass filter for every end of the op amp output. So according to the theory its cut of frequency is about 212 MHz (calculation some time may be I am wrong) but I just need to reduce the DC offset my frequency range is (1 KHz to 50 MHz) how can possible to pass this frequency in my op amp circuit.
    Please give me any suggestion 
    Attachments:
    OPA695ID.ms13 ‏371 KB

    Thank you. 
    I have a few more questions.
    1. Are C1 and C2 really 15 farad capacitors?
    2. What is the estimated capacitance of the antenna?
    3. What is the expected electric field and rate of change of the field at the antenna/capacitor? What kind of waveshape do you expect from real lightning and what are you using from XFG1 for simulation?
    4. What are the input and output impedances of XBP1? It looks like you have two outputs connected together - XBP1 and U4.
    5. You have pins 8 of the OPA6951 connected to VEE. What voltage is connected to VEE? The data sheet says Disable pin is usually left open for normal amplifier operation. It also says the typical enable voltage is 3.3 V.
    Lynn

Maybe you are looking for