Only related records.

Hello

It is an application of pharmacy, there are paintings of master / detail for "Sales_Return", which are "Sales_Return" (order_id, customer_no, sale_date, sales_return_date),

and "Sales_Return_Detail" (order_id, patch_no, item_id, quantity,...).

There might be a sales invoice includes some drugs with specific quantity (for example 20), the user may return the Bill several times,.

It might return 2 during the first, and then create another bill of Sales_Return with another 2 or 3 and so on.

so I could not create a primary key (order_id) because it could come back to the same bill several times, this is the first Bill creates the user might be:

Sales_Return
order_id
1
Order_id Patch_no Item_id Qty.
1111
1122

the second invoice can be same order_id, same item_id, different from the amount.

and the problem appears.

When I query the data "where order_id = 1", I will see 4 documents and not know what elements belong to the first returned order or a second one.

How to deal with this situation? How do I know which records belong to a specific order, and others do not?

Thank you very much.

Hello

s

Master-Salem wrote:

Hello

It is an application of pharmacy, there are paintings of master / detail for "Sales_Return", which are "Sales_Return" (order_id, customer_no, sale_date, sales_return_date),

and "Sales_Return_Detail" (order_id, patch_no, item_id, quantity,...).

There might be a sales invoice includes some drugs with specific quantity (for example 20), the user may return the Bill several times,.

It might return 2 during the first, and then create another bill of Sales_Return with another 2 or 3 and so on.

Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: Re: 2. How can I ask a question on the forums?

so I could not create a primary key (order_id) because it could come back to the same bill several times, this is the first Bill creates the user might be:

Sales_Return
order_id
1
Order_id Patch_no Item_id Qty
1 1 1 1
1 1 2 2

the second invoice can be same order_id, same item_id, different from the amount.

and the problem appears.

When I query the data "where order_id = 1", I will see 4 documents and not know what elements belong to the first returned order or a second one.

How to deal with this situation? How do I know which records belong to a specific order, and others do not?

Thank you very much.

There is no reason why you cannot have a primary key.  You gave a reason why order_id cannot be the primary key.  Another reason is that the primary key should not depened on real data, especially in a fact table.

Use a Surrogate key, for example, a number generated by sequence that does nothing except unique idnetify the line.

Tags: Database

Similar Questions

  • I just installed Prime Minister 11 items and when I save a project, it is only to record the audio.

    I just installed Prime Minister 11 items and when I save a project, it is only to record the audio. I made sure that export audio and video boxes are checked in the advanced Panel, but still only audio. When I went to save it, I got a pop up that says something in mircosoft wanting to make changes to my computer and I clicked on is not to think that they were related (and), but only audio get exported. I have quick time installed, but still nothing. Help, please!

    Amandaw

    There may be an explanation for what you are experiencing.

    On what computer operating system is your first items 11 running? Windows 8 or 8.1? And you are exporting to a file MPEG2.mpg and playback on Windows Media Player? If this is the case, please download and install the VLC Player

    VideoLAN - official page for VLC media player, the video frame Open Source!

    and let us know if export plays back video and audio on this drive.

    If that's the problem known Microsoft MPEG2 Windows Media Player, and then explore publish them + share/computer/possibilities other than MPEG or use VLC instead of Windows Media Player player for playback of MPEG2.mpg exports.

    Please let us know the result.

    Thank you.

    RTA

  • Need to view daq reads per second but only to record a reading every 10 minutes. I would also like to record the date and time, at the same pace. Need help

    Need to show daq reads per second, but only to record a reading every 10 minutes, need help

    You are also looking to taste to 1 Hz data acquisition?

    My approach would be to use the DAQ acquisition to time your loop display reading each acquisition, then use the loop counter to control the logic of your writing to file.  For 1 Hz and 10 minutes write I would use 'quotient and remainder' I / 600; If rest = 0, then write the data point.

    For the date and time, under Calendar palette use the time get in seconds food a DateTime Format to a string.

  • In XP PRO SP3 WMP11, will add all my files in the library. I added the folder, but it adds only 116 records 2000

    In XP PRO SP3 WMP11, will add all my files in the library. I added the folder, but it adds only 116 records 2000

    In XP PRO SP3 WMP11, will add all my files in the library. I added the folder, but it adds only 116 records 2000

    You cannot view, add, or delete items in the library of Windows Media Player 11

  • SQL loader is loading only one record

    I use SQL loader to load a CSV file into database

    sqlldr CON CONTROL = 'test.ctl' = 'TEST.log' = bad "bad.bad" LOG DATA = ' test. DAT'

    How ever I always only one record

    CTL file

    OPTIONS (ERRORS = 50)

    DOWNLOAD THE DATA

    ADD

    CONTINUEIF NEXT(1:1) = ' # '.

    IN TABLEtest

    FIELDS TERMINATED BY' '

    SURROUNDED OF POSSIBLY ' "" ' AND ' "'"

    TRAILING NULLCOLS)

    "Etest_ID" (27) TANK.

    'test_IND' CHAR (8),

    'test_SUB_IND' CHAR (12),

    "test_GIND1" TANK (9).

    "test_GIND2" TANK (9).

    'test_STATUS' CHAR (11),

    'test_STATUS' CHAR (11),

    'test_AMOUNT1' CHAR (14).

    'test_AMOUNT2' CHAR (14).

    'test_AMOUNT3' CHAR (14).

    'test_AMOUNT4' CHAR (14).

    "test_GIND21" TANK (9).

    "tet_GIND3" TANK (9).

    'test_STATUS1' CHAR (11),

    'test_STATUS2' CHAR (11),

    'test_AMOUNT1' CHAR (14).

    'test_AMOUNT2' CHAR (14).

    "test_FLAG" TANK (9).

    'test_USED_FLAG' CHAR (15).

    "test_FLAG" TANK (9).

    'TtestL_TRF_AMOUNT' CHAR (16).

    'testF_DATE' CHAR (8),

    'test_STATUS' CHAR (14))

    data file

    'AB00431MT00377_110915_00000 '."PP"."    "« Y »« Y »'TRAN '."FAILURE."'00000008667.15 '.'00000000000.00 '.'00000000000.00 '.'00000000000.00 '.« Y »« Y »'ZERO '.'ZERO '.'00000000000.00 '.'00000000000.00 '.« Y »« Y »" "'00000008667.15 '.'2111014 '.« S »
    'AB00431MT00377_110915_00000 '."PP"."    "« Y »" "'ZERO '."    "'00000000000.00 '.'00000000000.00 '.'00000000000.00 '.'00000000000.00 '.« Y »" "'ZERO '."    "'00000000000.00 '.'00000000000.00 '.« Y »" "" "'00000000000.00 '."0000000".« R »

    Help, please

    I tried generating CTL gall in various Noah this option worked. It is urgent please help

  • Help with the query to select only one record from the result set in double

    Hello

    Please help with the query. Version of Oracle database we use is 10g R2.

    I have a vision that is duplicated IDS, but they are used across the different functions. See below examples of data. Please help me with a query to select only one record (based on ID regardless of the area) from the bottom of the result set of duplicate records. For what is the point of view is there unique records, given the combination of the fields ID, Org, DF, dry, Sub-Sec

    ID
    Org
    DF
    Sec Sub-Sec

    (163)CQCPDMCPDMHD(163)PCENGENGENG(163)CQASICASICIS8888TSTACTACTAC(163)TSHEHESW6789CQINFOINFOFOS6789PCSECSYSSECSYSINFO16789TSSECSYSSECSYSINFO29009PCBMSBMSBMS1

    My result set must eliminate the duplicate identifiers regardless of whoever we choose of the result set. (I mean without distinction Org, DF, s, Sub-s). My expected result set should be.

    ID
    DSB

    DF
    SEC
    Sub-Sec
    (163)CQCPDMCPDMHD8888TSTACTACTAC6789CQINFOINFOFOS9009PCBMSBMSBMS1


    Thank you

    Orton

    Hello

    This sounds like a job for ROW_NUMBER:

    WITH got_r_num AS

    (

    SELECT id, DSB, df, s, sub_sec org

    ROW_NUMBER () OVER (PARTITION BY ID.

    ORDER BY org

    ) AS r_num

    OF view_x

    )

    SELECT id, DSB, df, sub_sec s,

    OF got_r_num

    WHERE r_num = 1

    ;

    He is a Top - N query example, where you choose the elements of N (N = 1 in this case) from the top of an ordered list.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and INSERT, only relevant columns instructions) to your sample data and the results desired from these data.  (I know that you said that you were a view selection.  Just for this thread, pretending it is a picture and post simple CREATE TABLE and INSERT statements to simulate your point of view).
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.  (I didn't quite understand the explanation above.  I don't know why you want to

    ID ORG DF DRY SUB_SEC

    --      ---     --      ---     -------

    1234 CQ DPRK DPRK HD

    and is not

    1234 IS CQ ASIC, ASIC

    or

    TS 1234 IT IT SW

    or

    1234 CQ ASIC ASIC HD

    )
    If you change the query at all, post your modified version.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • List of values do not fetch all records are read only 25 records of entry

    I have a vo... on which an attribute is to have a list of input values that came from other vo called peoplesearchvo...

    On the user interface, I get only 25 records in the list of input values... I tried several things but still did not work

    in the peoplesearchvo... Tuning part I gave all the rows in batches of 20, according to the needs... Mode... scroll and rangesize = 1

    On the user interface in the section of links to the properties of the iterator, it is rangesize - 25 and updating is the (delay) default mode.

    I did not change when even... I get only these 25 records failed to retrieve all records, even after I scroll down.

    Can you get it someone please let me know about it

    Thank you

    Yes, it is a bug in the ADF (fixed in 11.1.1.7.0).

    If you have oracle support account, see note: 1456824.1

    According to this note, you need to patch 13924897

    Dario

  • Why only first record?

    Hi, I have a bpel process, I read sap db with invoke I transform and write data to oracle. But it works only the first record. I see the i cannot read the XML all SAP db but I did not understand why he transform and written only first recorded. Any idea?

    Hello

    If you have several folders umay need to use foreach in the transformation.

  • Return only the records with a string of text that is less than a certain value?

    Hi people,

    I'm not sure whether this is possible or not, but worth-

    I need to be able somehow output only the lines with the text of a column field less to (because of the arguments) 30 characters (including spaces). I know that I can use CFs Left() function to cut the chain, but I don't want to have words cut off mid-sentence. Therefore, I want to somehow restrict the query to only the records that contain a string of less than 30 characters.

    Is this possible?

    Thanks in advance :-)

    You can use the length of the db function. It may or may not be named LEN()

    SELECT SomeColumn
    FROM YourTable
    WHERE LEN (SomeColumn)<=>

    Or you can retrieve all of the records and use one of the functions of the chain at cflib.org as FullLeft().
    http://www.cflib.org/UDF.cfm?id=329

  • Read CD only Gold records: Portege 660

    I had to format my portege 660cdt. I had no disc provided with lattop.
    Have installed win95 cd and works fine except that it is only the reading of Gold records. He did read other disks before formatting.

    Hello

    I put t really know what you mean with Gold records. You know very well that there is often no good explanation for some problems that occur especially for the oldies.

    If the device can read original discs of music or data discs I put t see any problem. It's always nice to know that someone is very pleased with these older devices.

    Good luck!

  • Only audio recording with TCS?

    Hello

    is it possible to record with an audio only TC?

    -I know that I could cut out the audio file for the video, but not what the customer wants to have

    -J' tried to create a new Configuration of the call, but it is not possible to deselect all video codecs

    any ideas?

    You mention not what revision of software your TCS runs, so unless it's something really old, then you can create a template with audio only, then create an alias using this model record.

    /Jens

  • LOV opened from column in the table always showing only 25 records

    Hello. I'm on Jdev 11 g R1.

    I have main VO with an attribute with LOV (entry LOV). The LOV VO defined in tuning as 'all lines' and range is set to-1

    Main LOV fell into the page and column is made in the form of entry-level LOV as expected. Everything works ok.

    But when I opened the LOV is showing 25 records. I have to scroll to the end and click on the button "Search" once again to see the rest of the records (total 48). It shows not all records and scrolls automatically when I start to scroll down, but stops at 25 records.

    I can't change the size of the beach of LOV since it is located in the table, so there is no access to the iterator LOV.

    How can I force LOV to see all records?

    As far as I KNOW, there is a bug in 11.1.2.x (and if you have a support contract, you can request the fix for it)

    Also associated with R1: list of input values does not fetch all records of documents only 25 are read

    Dario

  • GIFs only first recorded image

    Hello

    I use photoshop to create an animated GIF. Everything is perfect, but when I want to export a record for the web, only the first image is saved. I have this message in a file debud: [0423 / 122459:ERROR:crashpad_client_win.cc (316)] CreateProcess: the specified file is not found. (0x2) in french, but I am french and if I translate, I think it's:

    [0423 / 122459:ERROR:crashpad_client_win.cc (316)] CreateProcess: the file is not found. (0x2).

    Can you help me?

    Thank you.

    Reinstall Photoshop should be fixed. You could try CC cleaner to remove Photoshop then install.

    The Adobe Creative Cloud Cleaner tool allows to solve installation problems

    If it still does not work, let us know.

  • duplicate only delete records in a table w / composite primary

    I have a table that uses three columns of the primary key.
    There a few records in doubles because of some mistakes of the past.
    How can I remove only one of each record in duplicate using a sql statement?
    I don't want to do anything that requires the removal of the table.
    All I found so far have been average to drop two duplicate records, not one of them.

    I'm sure I could write a pl sql script to do this, but I just want to know how to do it with sql only if possible. Someone knows how to do that, or nobody knows whether or not it is still possible given my constraints?

    Thank you

    849655 wrote:
    Brian,

    That's what I did with his suggestion and 2-3 other times where I found he does the same in other places. However, as I said, I lose again all duplicates, not one of the duplicates (isn't it logical?)

    Maybe it's a bad support so far. Why would you not want to remove ALL duplicates (that means you leave exactly ONE instance of a single record).

    Can you put together a simple case for us show what you need to keep?

    ME_ORCL?drop table tutorial;
    
    Table dropped.
    
    Elapsed: 00:00:00.14
    ME_ORCL?
    ME_ORCL?create table tutorial
      2  (
      3     col1 number,
      4     col2 number
      5  );
    
    Table created.
    
    Elapsed: 00:00:00.00
    ME_ORCL?
    ME_ORCL?insert into tutorial select mod(level, 3), level from dual conne
    
    10 rows created.
    
    Elapsed: 00:00:00.00
    ME_ORCL?
    ME_ORCL?commit;
    
    Commit complete.
    
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?select * from tutorial;
    
                  COL1               COL2
    ------------------ ------------------
                     1                  1
                     2                  2
                     0                  3
                     1                  4
                     2                  5
                     0                  6
                     1                  7
                     2                  8
                     0                  9
                     1                 10
    
    10 rows selected.
    
    Elapsed: 00:00:00.03
    ME_ORCL?
    ME_ORCL?delete from tutorial
      2  where rowid not in
      3  (
      4     select min(rowid)
      5     from tutorial
      6     group by col1
      7  );
    
    7 rows deleted.
    
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?select * from tutorial;
    
                  COL1               COL2
    ------------------ ------------------
                     1                  1
                     2                  2
                     0                  3
    
    3 rows selected.
    
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?rollback;
    
    Rollback complete.
    
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?delete from tutorial
      2  where rowid in
      3  (
      4     select rid
      5     from
      6     (
      7        select
      8           rowid rid,
      9           row_number() over ( partition by col1 order by rowid ) rn
     10     from tutorial
     11     )
     12     where rn > 1
     13  );
    
    7 rows deleted.
    
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?select * from tutorial;
    
                  COL1               COL2
    ------------------ ------------------
                     1                  1
                     2                  2
                     0                  3
    
    3 rows selected.
    
    Elapsed: 00:00:00.03
    ME_ORCL?
    

    Something like that. As you can see, these two removed all duplicates, leaving 1 unique value for COL1.

  • Several of the related records in a table

    Hi all

    A query more to add. I have a report which lists all the opportunities for me.
    This is a list report and it shows me all the related information for the occasion.
    Here, I have the problem. I have several competitors and partners for the occasion.
    But in the report, I see only one competitor/partner for this opportunity. I need all these to be included in a single report.

    Any suggestions?

    Thanks in advance.
    Imtiaz.

    You must add a table and have each as usual for competitors.
    Hope its clear.

Maybe you are looking for

  • Relink proxy mp4 sony with XAVC-L MXF files

    My camera (Sony FS5) can save UHD 4 k files and mp4 proxies at the same time. Now, I want to use the MP4 files for editing so I save use as XAVC-L uses much CPU. How can I say FCPX to reconnect the Proxy to the MXFs files? I get an error they are inc

  • HP Pavilion G6 (1207sg): change the CPU will also apply its iGPU in the system?

    Hello I have a laptop HP G6 and want to upgrade his CPU (i3 - 2330 m with HD 3000 iGPU) in an i3 - 3110 m with HD 4000. I did check the socket (rPGA988B) and it doesn't seem to be compatible. This change will also properly implant the new iGPU, or ar

  • Search for items in. INI file

    Good afternoon First of all, I work with INI files and Excel files. In fact, all my items in my several INI files are also written in a single Excel file like this: First INI file Tag name |     Value |     Name of the section Tag name |     Value |

  • dateserverhandler.VI

    An example VI OR example Finder refers to a vi called "dateserverhandler.vi".  I can't find that VI. Someone at - it a copy? Appellant VI is DateServerUsingReentrantRun.vi

  • Write the spectrum of power + other tables to PDM

    Hello world! I am building a project of data acquisition, using compactDAQ to measure and record data from an accelerometer. The main objective is to save the data of acceleration, speed, displacement and frequency in a PDM spectrum, but I'm having s