Database column updates based on 2 fields being equal to two tables

I get an error 1427 when you try to update a field in tables.

I have about 30 000 records in tableA and about 2500 in tableB

I'm trying to update a field in tableA based on equality of the 2 fields in each table.

Update tableA a set a.Col1 =
(select b.Col1 from tableB b where a.Col2 = b.Col2 and a.Col3 = b.Col3);

There are several rows in tableA that should be whether the selection is true.

I think I need to write some PL/SQL, but not sure.

Any ideas?

Thank you
ANON

Anon,

I don't know how to put your data, but you can try a merger in tablea with a distinct subset of tableb.

merge into tablea t
using (select distinct col1, col2, col3 from tableb) s
on (t.col2 = s.col2 and t.col3 = s.col3)
when matched then
update
   set  t.col1 = s.col1
 where  t.col1 != s.col1
    or (t.col1 is null and s.col1 is not null)
    or (t.col1 is not null and s.col1 is null);

Concerning
Peter

Tags: Database

Similar Questions

  • The Master Table column updated based on the sum of column Table detail


    With the help of JDev 11.1.1.6.

    I have a master-detail table based on a link to BC.

    The main table has a column that displays an InputText or an OutputText, based on the value in another column.

    If the InputText is displayed, the user can enter a value and the database will be updated with that value.

    If the OutputText is displayed, it must be a sum of a column in the secondary table.  Also, this value will be written in the database.

    Question:

    How can I fill the OutputText in the main table with the sum of the values in a column in the secondary table?

    The detail table column is a manually entered InputText field.

    Thank you.

    Create a spike in the main table and write in its expression as follows - DetailVoAccessorName.sum ("ColumnName");

    This will calculate the sum of column table detail and then you can set the value of the transient attribute to attribute DB on backup operation

    Ashish

  • Make a mandatory DFF field based on another field

    Hi all

    We have a requirement where we need to do a mandatory DFF field based on another field.

    example:

    FDF has two fields:

    Depose1: the values 'Email', 'Fax '.
    Depose2

    If "Email" is selected in 'Field1' Field2 should become mandatory.

    All entries on this will be really useful.

    Thank you and best regards,
    Satya.

    Please see old topics that cover the same subject - http://forums.oracle.com/forums/search.jspa?threadID=&q=DFF+AND+mandatory+ANd+Dependant&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001

    Thank you
    Hussein

  • Cannot update a single display field when writing the record in the database

    Hello all-

    I have a situation in which I displays a record in a form.  Most of the fields are editable by the user and is written back to the database table when the user clicks on the button changes to.  However, there are two fields that are show in view-only mode.  I don't want users to be able to change these fields.  On the contrary, they are modified programmatically to a specific date and time in these areas and the ID of the user in the update to field.  Then the file is submitted to the database.

    If these fields are defined as TEXT fields, they write back to the database correctly.

    If these fields are defined in VIEW ONLY mode, they do not get rewritten on the basis of data - whatever values are in here are ignored.

    Here's the question: is it possible to not allow the user to change these fields, but always show them and also allow them to be updated before registration gets written back to the database?

    Thank you!

    John Ramuta

    Adjust your column 'display as': text field

    Then scroll down to the section 'Element' and 'attribute of the HTML Form element' enter readonly text

  • How not to show duplicate lines, based on a field

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0

    Hello

    I have a query that looks like some scripts that did not stand on a given date compared to what ran the same day about a week ago. We want to include the start_datetime and the end_datetime but when I add it to the select statement, it evokes all instances of jobs that run several times during the day. Is it possible to exclude the extra lines based on the field of script_name?
    SELECT instances.script_name, 
                             instances.instance_name, 
                             REGEXP_REPLACE(master.description, 
                                            chr(49814),  -- em-dash
                                            '-') description
                                            --instances.start_datetime
                      FROM   xxcar.xxcar_abat_instances Instances,
                             xxcar.xxcar_abatch_master  Master
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS')) - (:p_NumOfWeeks * 7)
                      AND    Instances.SCRIPT_NAME = Master.SCRIPT_NAME (+)
                      MINUS
                      SELECT script_name, 
                             instance_name, 
                             NULL
                             --NULL
                      FROM   xxcar.xxcar_abat_instances 
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS'))

    LESS performs a set operation - remove lines from the first series that exactly match the second set.
    When you add columns to the first series, you want a smaller filter - try a NOT IN multi-column:
    To remove several courses, to regroup and get min/max

    SELECT instances.script_name,
                             instances.instance_name,
                             REGEXP_REPLACE(master.description,
                                            chr(49814),  -- em-dash
                                            '-') description,
                             min(instances.start_datetime) start_datetime,
                             min(instances.end_datetime) end_datetime
                      FROM   xxcar.xxcar_abat_instances Instances,
                             xxcar.xxcar_abatch_master  Master
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS')) - (:p_NumOfWeeks * 7)
                      AND    Instances.SCRIPT_NAME = Master.SCRIPT_NAME (+)
                      AND (script_name, instance_name) NOT IN
                    ( SELECT script_name,
                             instance_name
                      FROM   xxcar.xxcar_abat_instances
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS'))
                    )
    group by instances.script_name, instances.instance_name, master.description
    

    You do not give the definitions of table and query schemas in him, therefore I don't test it.

    Kind regards
    David

  • Download any file in the database column

    Hi all

    Is it possible that I can download any file in a column of data?

    I use oracle forms 6i and oracle database 10g.

    Kind regards

    Atif Zafar

    Dear Sir

    You can select the built-in file using GET_FILE_NAME. And then copy the file into the database using HOST Directory integrated (using the CMD). After you copy the file in the database directory, you can call the procedure of database to update the database file.

    Manu.

  • I create a form based on two tables that have sequences also. When I create insert only row is inserted in the fields in table first and second fields of the table are empty. Why?

    Mr President.

    I create a form based on two tables that have sequences also. When I create insert only row is inserted in the fields in table first and second fields of the table are empty. Why?

    formdoubletables.png

    the page source is

    <?xml version='1.0' encoding='UTF-8'?>
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                    xmlns:f="http://java.sun.com/jsf/core">
      <af:panelFormLayout id="pfl1">
        <af:group id="Group">
          <af:inputText value="#{bindings.VoucherId.inputValue}" label="#{bindings.VoucherId.hints.label}"
                        required="#{bindings.VoucherId.hints.mandatory}" columns="#{bindings.VoucherId.hints.displayWidth}"
                        maximumLength="#{bindings.VoucherId.hints.precision}"
                        shortDesc="#{bindings.VoucherId.hints.tooltip}" id="it1">
            <f:validator binding="#{bindings.VoucherId.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.VoucherId.format}"/>
          </af:inputText>
          <af:inputDate value="#{bindings.VoucherDate.inputValue}" label="#{bindings.VoucherDate.hints.label}"
                        required="#{bindings.VoucherDate.hints.mandatory}"
                        columns="#{bindings.VoucherDate.hints.displayWidth}"
                        shortDesc="#{bindings.VoucherDate.hints.tooltip}" id="id1">
            <f:validator binding="#{bindings.VoucherDate.validator}"/>
            <af:convertDateTime pattern="#{bindings.VoucherDate.format}"/>
          </af:inputDate>
          <af:inputText value="#{bindings.Credit.inputValue}" label="#{bindings.Credit.hints.label}"
                        required="#{bindings.Credit.hints.mandatory}" columns="#{bindings.Credit.hints.displayWidth}"
                        maximumLength="#{bindings.Credit.hints.precision}" shortDesc="#{bindings.Credit.hints.tooltip}"
                        id="it2">
            <f:validator binding="#{bindings.Credit.validator}"/>
          </af:inputText>
        </af:group>
        <af:group id="g1">
          <af:inputText value="#{bindings.Lineitem.inputValue}" label="#{bindings.Lineitem.hints.label}"
                        required="#{bindings.Lineitem.hints.mandatory}" columns="#{bindings.Lineitem.hints.displayWidth}"
                        maximumLength="#{bindings.Lineitem.hints.precision}" shortDesc="#{bindings.Lineitem.hints.tooltip}"
                        id="it3">
            <f:validator binding="#{bindings.Lineitem.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.Lineitem.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.VoucherId1.inputValue}" label="#{bindings.VoucherId1.hints.label}"
                        required="#{bindings.VoucherId1.hints.mandatory}"
                        columns="#{bindings.VoucherId1.hints.displayWidth}"
                        maximumLength="#{bindings.VoucherId1.hints.precision}"
                        shortDesc="#{bindings.VoucherId1.hints.tooltip}" id="it4">
            <f:validator binding="#{bindings.VoucherId1.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.VoucherId1.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Debit.inputValue}" label="#{bindings.Debit.hints.label}"
                        required="#{bindings.Debit.hints.mandatory}" columns="#{bindings.Debit.hints.displayWidth}"
                        maximumLength="#{bindings.Debit.hints.precision}" shortDesc="#{bindings.Debit.hints.tooltip}"
                        id="it5">
            <f:validator binding="#{bindings.Debit.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Credit1.inputValue}" label="#{bindings.Credit1.hints.label}"
                        required="#{bindings.Credit1.hints.mandatory}" columns="#{bindings.Credit1.hints.displayWidth}"
                        maximumLength="#{bindings.Credit1.hints.precision}" shortDesc="#{bindings.Credit1.hints.tooltip}"
                        id="it6">
            <f:validator binding="#{bindings.Credit1.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Particulars.inputValue}" label="#{bindings.Particulars.hints.label}"
                        required="#{bindings.Particulars.hints.mandatory}"
                        columns="#{bindings.Particulars.hints.displayWidth}"
                        maximumLength="#{bindings.Particulars.hints.precision}"
                        shortDesc="#{bindings.Particulars.hints.tooltip}" id="it7">
            <f:validator binding="#{bindings.Particulars.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Amount.inputValue}" label="#{bindings.Amount.hints.label}"
                        required="#{bindings.Amount.hints.mandatory}" columns="#{bindings.Amount.hints.displayWidth}"
                        maximumLength="#{bindings.Amount.hints.precision}" shortDesc="#{bindings.Amount.hints.tooltip}"
                        id="it8">
            <f:validator binding="#{bindings.Amount.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.Amount.format}"/>
          </af:inputText>
        </af:group>
        <f:facet name="footer">
          <af:button text="Submit" id="b1"/>
          <af:button actionListener="#{bindings.CreateInsert.execute}" text="CreateInsert"
                     disabled="#{!bindings.CreateInsert.enabled}" id="b2"/>     
          <af:button actionListener="#{bindings.Commit.execute}" text="Commit" disabled="#{!bindings.Commit.enabled}"
                     id="b3"/>
          <af:button actionListener="#{bindings.Rollback.execute}" text="Rollback" disabled="#{!bindings.Rollback.enabled}"
                     immediate="true" id="b4">
            <af:resetActionListener/>
          </af:button>
        </f:facet>
      </af:panelFormLayout>
    </ui:composition>
    
    
    
    

    Concerning

    Go to your VO Wizard, select the tab of the entity and to check if both the EO is editable or not.

    See you soon

    AJ

  • Cannot display the results to the database during "Update": SQL statement

    Hello

    I get this error trying to update a VO via the UI or BCBrowser.

    Cannot display the results to the database during "Update": SQL statement

    This is a default single front & right THAT VO creates on the object of the entity (Database Table)

    On the same table and with the same credentials of DB, I could update the record.

    Any guess on what went wrong?

    Thanks in advance for any help.

    p.s Jdev 11.1.1.6

    Journal:

    oracle.jbo.DMLException: Houston-26041: could not publish data from database in "Update": SQL statement "START the CAR UPDATED CarEO SET SEL_ITEM =: 1 WHERE TXN_NO =: 2 AND LOGID =: AND SEQNO = 3: 4 POLL DELIVERY_MODE, CERTIFICATION_REQ, SOFT_COPY_IND, SELITEM IN: 5,: 6,: 7,: 8; END; ».

    at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:583)

    at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:8575)

    at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:6816)

    at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:3290)

    at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:3093)

    at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:2097)

    at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2378)

    at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1615)

    at oracle.adf.model.binding.DCDataControl.callCommitTransaction(DCDataControl.java:1417)

    at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1437)

    at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2150)

    at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:740)

    at oracle.jbo.uicli.jui.JUActionBinding.actionPerformed(JUActionBinding.java:193)

    at oracle.jbo.uicli.controls.JUNavigationBar.doAction(JUNavigationBar.java:412)

    at oracle.jbo.jbotester.NavigationBar.doAction(NavigationBar.java:111)

    to oracle.jbo.uicli.controls.JUNavigationBar$ NavButton.actionPerformed (JUNavigationBar.java:118)

    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)

    in javax.swing.AbstractButton$ Handler.actionPerformed (AbstractButton.java:2318)

    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)

    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)

    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)

    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)

    at java.awt.Component.processMouseEvent(Component.java:6289)

    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)

    at java.awt.Component.processEvent(Component.java:6054)

    at java.awt.Container.processEvent(Container.java:2041)

    at java.awt.Component.dispatchEventImpl(Component.java:4652)

    at java.awt.Container.dispatchEventImpl(Container.java:2099)

    at java.awt.Component.dispatchEvent(Component.java:4482)

    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)

    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)

    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)

    at java.awt.Container.dispatchEventImpl(Container.java:2085)

    at java.awt.Window.dispatchEventImpl(Window.java:2478)

    at java.awt.Component.dispatchEvent(Component.java:4482)

    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)

    to java.awt.EventQueue.access$ 000 (EventQueue.java:85)

    in java.awt.EventQueue$ 1.run(EventQueue.java:603)

    in java.awt.EventQueue$ 1.run(EventQueue.java:601)

    at java.security.AccessController.doPrivileged (Native Method)

    in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:87)

    in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:98)

    in java.awt.EventQueue$ 2.run(EventQueue.java:617)

    in java.awt.EventQueue$ 2.run(EventQueue.java:615)

    at java.security.AccessController.doPrivileged (Native Method)

    in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:87)

    at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)

    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)

    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)

    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)

    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

    Caused by: java.sql.SQLException: invalid column type

    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterInternal(OracleCallableStatement.java:150)

    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:399)

    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:581)

    at oracle.jdbc.driver.OracleCallableStatementWrapper.registerOutParameter(OracleCallableStatementWrapper.java:1765)

    at oracle.jbo.server.OracleSQLBuilderImpl.bindUpdateStatement(OracleSQLBuilderImpl.java:2243)

    at oracle.jbo.server.EntityImpl.bindDMLStatement(EntityImpl.java:10524)

    at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:412)

    ... 52 more

    The problem is solved now.

    new columns added to the database table, after the creation of the entity object. Those changes were not picked up in the entity object.

    I found this difference after object entity with the DB Table comparison.

    And when I added these new columns to EO & VO, I don't get this error more.

    Thanks to all who tried to help

  • Choose field from the joined table based on another field?

    Hello!

    Is it possible to select a field in a row of attached table based on another field? Consider the following data in the CVALUES table:
    ID  C1   C2    C3    C4    C5    C6
    T1  9.6  10.3  12.4  19.6  19.6    0
    T7  9.6  10.4     0     0     0    0
    T3  8.2   9.9  11.4  19.6  19.6    0
    T8  8.3  10.7  13.5  20.7     0    0
    T5  9.4  10.3  12.7  22.9  19.6    0
    ...
    And the following data in the table MDETAIL:
    ID           MDATE        CNUM     ...
    T1  03/28/2012 18:00:00    4
    T1  03/28/2012 18:00:00    1
    T8  03/29/2012 06:00:00    6
    T8  03/29/2012 06:00:00    5
    ...
    I want to get the column corresponding to the VALUE field in the table MDETAIL CVALUES. I'm doing this:
    SELECT m.t1, m.mdate,
           CASE WHEN m.cnum = 1 THEN c.c1
                WHEN m.cnum = 2 THEN c.c2
                WHEN m.cnum = 3 THEN c.c3
                WHEN m.cnum = 4 THEN c.c4
                WHEN m.cnum = 5 THEN c.c5
                WHEN m.cnum = 6 THEN c.c6 END AS cvalue
      FROM mdetail m
      JOIN cvalues c ON m.id = c.id
    The CVALUES table records are unique; only one line by ID.

    This method works and it's fast, but it's messy code and I think there must be a better way to do it. I use cvalue value in several calculations so each calculation that I use is this giant glob of CASES inside!

    Hello

    With a decoding it would be easier, but as ugly :-)

    SELECT m.t1, m.mdate,
           DECODE( m.cnum , 1 , c.c1, 2, c.c2, 3, c.c3, 4, c.c4, 5, c,c5, 6, c,c6) cvalue
      FROM mdetail m, cvalues c
      WHERE m.id = c.id
    

    Success!

    FJFranken

  • Update if Value record field does not match

    Hi all
    I'm using Toad for Oracle 10. I have a process of FUSION IN which update tbl_requisition based on FK - equal to parent table tbl_allotment PK fk_allotment_id - pk_allotment_id. Both tables have create, update and delete triggers. The process is performed when a button apply changes/to tbl_allotment day. Thus, all data registration of tbl_allotment update tbl_requisition record if pk and fk keys are equal. My problem is that if a record is updated within the tbl_requisition. Tbl_requisition record is now different from tbl_allotment. If a value is updated for the corresponding pk_allotment_id tbl_allotment = tbl_requisition fk_allotment_id record. save data tbl_allotment will replace the update in the tbl_requisition value. I want to update only the values that have been updated or modified and are not equal to tbl_allotment to tbl_requisition. Can someone help me with this?
    Begin
    MERGE INTO tbl_requisition req
    USING tbl_allotment alt
    ON (req.fk_allotment_id = alt.pk_allotment_id)
    WHEN MATCHED THEN
    UPDATE SET
         req.FK_JOBCODE_ID = alt.FK_JOBCODE_ID,
         req.FK_JOBCODE_DESCR = alt.FK_JOBCODE_DESCR,
         req.FK_JOBCODE_PAYRANGE = alt.FK_JOBCODE_PAYRANGE,
         req.FK_PAY_RANGE_LOW_YEARLY = alt.FK_PAY_RANGE_LOW_YEARLY,
         req.FK_DEPARTMENT_ID = alt.FK_DEPARTMENT_ID,
         req.FK_DIVISION_ID = alt.FK_DIVISION_ID,
         req.FK_NUMBER_OF_POSITIONS = alt.NUMBER_OF_POSITIONS,
         req.FK_DEPARTMENT_NAME = alt.FK_DEPARTMENT_NAME,
         req.FK_DIVISION_NAME = alt.FK_DIVISION_NAME,
         req.REPORT_UNDER = alt.REPORT_UNDER;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        dbms_output.put_line('No data found');
    End;
    Thanks for reading this thread and I hope someone can help. If tables to create or what is needed is not a problem of supply.

    Hello

    What you request will have a lot of code, but the code is not very complicated.
    It seems that, for each column, you must remember when it has been changed. You can do this by using triggers on each table. For each fk_x column that contains data, you will need a DATE column (let's call it mdt_x for the date modified) that records when fk_x on this line has been changed.
    In the MERGE statement, for each column of such, you say something like:

    temp.FK_JOBCODE_DESCR     = CASE
                           WHEN  alt.mdt_jobcode_descr   > temp.mdt_jobcode_descr
                        THEN  alt.fk_jobcode_descr
                         ELSE  temp.fk_jobcode_descr
                       END
    

    In other words, if the line is updated, and then all the columns in the row will be updated, but the CASE statement above may decide that the new value will be what was in the temporary table ratehr (i.e., no change) than what comes from the table ALT.

    For example, that temp.mdt_jobcode_descr is alt.mdt_jobcode_desc 11:30 and 11:00 the same day. At 12:00 that day here, you run the MERGER. The WHEN condition above will have the value TRUE, then temp.fk_jobcode_descr will be changed to alt.fk_jobcode_descr. The trigger of temp will change temp.mdt_jobcode_descr to 12:00.

  • Unknown column in the PHP/MySQL field list

    I created a feedback form for our airshow site and it works great. I now create some pages of the review, which are also working well, then

    ... I decided to improve one of the review pages and now it does not work... sigh.

    We ask stakeholders to provide their zip code and I have a vision showing the number of responses by postcode, this works very well and can be seen here http://www.hollisterairshow.com/feedback-results.php , so I decided to improve it by adding the City / State based on zip code. I created a new table called 'postcodes' and imported a list of zip codes and city / state info - all the 42,000 + of them.

    The PHP/MySQL, who works is illustrated below

    <? PHP
    Connect MySQL

    $query = "SELECT zip, COUNT (zip) ZIP GROUP BY feedback";

    $result = mysql_query ($query) or die (mysql_error ());

    Print results
    While ($row = {mysql_fetch_array ($result))}
    echo $row ["zip"]. " ". $row ['COUNT (zip)'];
    echo "< br / > ';
    }
    ? >

    As I am now faced with two tables, I thought that I had to add the name of the table in any field, so I added the names of tables and fields to the new table so

    I changed the PHP / MySQL as follows

    <? PHP
    Connect MySQL

    $query = 'SELECT feedback.zip, COUNT (feedback.zip), zipcodes.citystate OF feedback codes postal WHERE feedback.zip = zipcodes.zipcode GROUP BY feedback.zip';

    $result = mysql_query ($query) or die (mysql_error ());

    Print results
    While ($row = {mysql_fetch_array ($result))}
    echo $row ['feedback.zip']. " ". $row ['COUNT (feedback.zip)']. " ". $row ['zipcodes.citystate'];
    echo "< br / > ';
    }
    ? >

    and it fails when I run it says ' Unknown column 'feedback.zip' in "field list '"

    I would be grateful any suggestion on this, I am new on this PHP/MySQL stuff.

    Thank you

    Tony

    Tables listed in the From clause must be separated by commas. As it is, it is evaluated as an alias.

  • Is it possible to refine "Item as database column" in the mail...

    Hello
    Is it possible to refine "Item as database column" in post reclassification calculation that it is not made by the update process
    number of items is more that I use the query, so I'd rather use the database column.


    concerning

    Published by: sak on July 5, 2010 12:00

    Published by: sak on July 5, 2010 12:01

    Published by: sak on July 5, 2010 12:05

    If you perform any calculation of post on a database "column", which is equivalent to a 'change' in value and therefore is detected as a change in the ApplyMRU process.

    You may need to write SRM custom for this when you manage the 'meaning' to update as you wish.

    Kind regards

  • pair of value/label for control dynamicallly ring populated from database column

    Hi all

    I have a control of the ring in my UI that I need to dynamically fill columns from the MS SQL database. I can get the result of the database and line-by-line reading. So to create a table with the pairs value/label and pouplate control of the ring using InsertListItem? or is there a better way to do it?

    Thank you

    Kanu

    I'm not aware of a method to populate one control ring other than a loop in your table and by calling InsterListItem for each element of the array.

  • How can I change the screen of fast connection of GUI to database text/Dos based. (Vista)

    Just as the title says; If you could give instructions step by step on how to do so; then it would be appreciated. Thank you for your time.

    Hello

    Unfortunately, it is not possible to change the screen of fast connection of GUI to database text/Dos based.

    You can provide your comments on the forum below.

    http://mymfe.Microsoft.com/Vista/feedback.aspx?formid=83

  • INSERT or update based on the quantity and the description

    I have a table of transaction known as ot_cut_detail based on who i need to update or insert into two tables that have missing information. There are two criteria, we must first check if the cut_ps_desc is as pl or not like pl, if the description of cut_ps_desc is as pl he will check and update or insert into ot_actual_dtl_pl, or else it will update or insert into ot_actual_dtl, to the corresponding cut_pm_code and cut_ps_code as act_pm_code act_ps_code ot_actual_dtl and act_pm_code_pl, act_ps_code_pl in ot_actual_dtl_pl, which can be found below. quantities to both ot_actual_dtl and ot_Actual_dtl_pl are located in each row.the test case is the following.

    {code}

    create table ot_cut_detail (cut_pm_code varchar2 (12), cut_ps_code varchar2 (12), cut_ps_desc varchar2 (12), the number of cut_ps_qty);

    insert into ot_cut_detail (cut_ps_code, cut_ps_desc, cut_pm_code, cut_ps_qty) values ('1001 ', "A001", "HEA", 3);

    insert into ot_cut_detail (cut_ps_code, cut_ps_desc, cut_pm_code, cut_ps_qty) values ('1002 ', 'A002', 'PL', 2);

    insert into ot_cut_detail (cut_ps_code, cut_ps_desc, cut_pm_code, cut_ps_qty) values ('1003 ', 'A003', 'PL', 2);

    create table ot_actual_dtl (act_pm_code varchar2 (12), act_ps_code varchar (12), the number of act_qty);

    insert into ot_actual_dtl (act_pm_code, act_ps_code, act_qty) values ('1001', "A001", 1);

    insert into ot_actual_dtl (act_pm_code, act_ps_code, act_qty) values ('1001', "A001", 1);

    insert into ot_actual_dtl (act_pm_code, act_ps_code, act_qty) values ('1001', "A001", 0);

    create table ot_actual_dtl_pl (actp_pm_code varchar2 (12), actp_ps_code varchar (12), the number of actp_qty);

    insert into ot_actual_dtl_pl (actp_pm_code, actp_ps_code, actp_qty) values ('1002', "A002", 1);

    -required output is as follows

    -in the table ot_Actual_dtl

    act_pm_code, act_ps_code, act_qty

    ' 1001', "A001", 1

    ' 1001', "A001", 1

    ' 1001', "A001", 1 - line last updated 1 since she was not corresponding to the amount of ot_cut_detail

    -case 2

    -by ot_Actual_dtl_pl

    actp_pm_code, actp_ps_code, actp_qty

    "1002", 'A002', 1

    "1002", 'A002', 1 - inserted recording missing with balance Qty

    ' 1003', "A003", 1 -inserted recording missing with balance Qty .

    {\code}

    ' 1001', "A001", 1 - line last updated 1 since she was not corresponding to the amount of ot_cut_detail

    Update ot_cut_detail table with 0 whenever 0 or null comes (guess that there are relationships between these tables. So no need to check the data of wherther there or not) of the foregoing. Here's the update statement

    Ot_actual_dtl ADO UPDATE

    SET oad.act_qty = 1

    WHERE NVL(oad.act_qty,0) = 0

    ;

    After the update, there is a 0 in the table. So now you can insert the rows required for both the table. Here I first, I checked the corresponding record exists in ot_cut_detail or not. If is to insert into the table else insert into ot_actual_dtl_pl (assumes that registration will not be there with Qty 0 in the table ot_actual_dtl_pl). This is the insert all THE

    INSERT ALL

    WHEN the flag = "ACTP" THEN

    IN ot_actual_dtl_pl (actp_pm_code, actp_ps_code, actp_qty) VALUES (pm_code, ps_code, ps_qty)

    WHEN the flag = "Act" THEN

    IN ot_actual_dtl (act_pm_code, act_ps_code, act_qty) VALUES (pm_code, ps_code, ps_qty)

    WITH qry1 AS

    (

    SELECT ocd.cut_pm_code,

    OCD.cut_ps_code,

    OCD.cut_ps_qty,

    OCD.cut_ps_qty - Sum (NVL(OAD.act_qty,0)) act_qty,

    OCD.cut_ps_qty - Sum (NVL(OADP.actp_qty,0)) actp_qty

    Of ot_cut_detail OCD

    LEFT OUTER JOIN ot_actual_dtl ADO

    ON ocd.cut_pm_code = oad.act_pm_code

    AND ocd.cut_ps_code = oad.act_ps_code

    LEFT OUTER JOIN ot_actual_dtl_pl oadp

    ON ocd.cut_pm_code = oadp.actp_pm_code

    AND ocd.cut_ps_code = oadp.actp_ps_code

    Ocd.cut_pm_code GROUP,

    OCD.cut_ps_code,

    OCD.cut_ps_qty

    ),

    qry2 (pm_code, ps_code, ps_qty, Qty, Flag) AS

    (

    Cut_pm_code SELECT pm_code,

    cut_ps_code ps_code,

    1 ps_qty,

    1 qty

    CASE WHEN (q1.act_qty <> q1.cut_ps_qty) THEN the 'ACT' ELSE "ACTP" END flag

    OF qry1 q1

    WHERE q1.act_qty<=>

    AND q1.act_qty <> 0

    AND q1.actp_qty <> 0

    UNION ALL

    SELECT q2.pm_code,

    Q2.ps_code,

    Q2.ps_qty,

    Q2. Qty + 1,

    flag

    OF qry2 q2, q1 qry1

    WHERE q2.pm_code = q1.cut_pm_code

    AND q2.ps_code = cut_ps_code

    AND q2.qty + 1 <= case="" when="" (q1.act_qty=""> <> q1.cut_ps_qty) THEN q1.act_qty ELSE q1.actp_qty END

    )

    SELECT q2.pm_code,

    Q2.ps_code,

    Q2.ps_qty,

    Q2. Flag

    OF qry2 T2

    ;

    You must follow two steps.

    Step 1:-update the table with 0 (1st update statement)

    Step 2:-once the update is finished, insert into table using INSERT ANY State.

Maybe you are looking for

  • renewal automatic app

    I have an app subscription that is automatically renewed each year. How/where can I disable this function? I want to renew manually. Thanks for any help/advice!

  • Re: Qosmio X 870 - Win8 on a separate partition

    HelloI have a Qosmiox870 and that means that I also have a Microsoft windows8 (OEM) product key I have problems with conflicting devices drivers... and to grow the best way, I need to install a new fresh windows8 version on a separate partition. So o

  • How can I get rid of game Center and the gargowitsch process?

    My Mac are dedicated to work. I games have never played on them and never will. Everything about that I want to go. There is this annoying bit of software called "garguillo" who insists on talking to the outside world and I need to find a solution fo

  • Satellite L650-120 - renovations of video card

    Good afternoon. I want to understand why are not completed renovations of the video card ATI HD5650? Who can know that? Thank you.

  • How to install wireless on a Satellite 5200 903?

    Due to a very bad virus, I got Windows on a Satellite 5200 903 a friendly businessman. But at home he saw: no wireless LAN could be used... It seems, that cause the WLAN switch is 'off' no WLAN-driver was installed/recovered... Now, he wants to come