Is it possible to update a query with another query?

I'm trying to update a query with another query (see attached
code). Here's my setup: I've got a table in an Access database in
which I enter a string into a form and update. This string
corresponds to a single record in another table of the same
datasource. The first table has only one record to provide the
second, which has many and will have more. Basically what I'm
wondering is: Is this a valid thing to do in coldfusion? If not
please help with an alterate method. I'm still a novice at
coldfusion.
The overall effect I'm going for is to display the one record
as a featured truck profile on the web site:
www.truckerstoystore.net.
I currently get an error when I try to display the page with the
current query setup.
Check this page to see the error:
www.truckerstoystore.net/currentTOW2.cfm
Help on this issue is very much appreciated.
------------------------------------------------------------------------------------------ -----------------------------------------------------------------------

I think this is what you are after
<!--- this query will get all the records from the DB
--->
<cfquery name="cTOW" datasource="tow">
SELECT *
FROM currentTOW
<!--- Do you need to find a particular record in the
database --->
<!--- If so, then you need a 'where' clause in here
--->
</cfquery>
<!-- Loop the cTOW query for each record returned -->
<cfloop query="cTOW">
<!--- For the record returned from the cTOW query you now
need to update the table --->
<!-- Update the table -->
<cfquery name="currentTOW" datasource="tow">
UPDATE Your tblName
SET
Dataname = cTOW.DataValue
</cfquery>
</cfloop>
thats it
PS: I think your original query needs modifying. To return
the exact records that you want to update from the original table.
ie: Primary and foreign key relationship

Similar Messages

  • HT204266 how can I update my app with another account?

    how can I update my app with another account?

    kambiz.fakhr wrote:
    how can I update my app with another account?
    Anything Downloaded with a Particular Apple ID is tied to that Apple ID and Cannot be Merged or Transferred to a Different Apple ID
    Apple ID FAQs  >  http://support.apple.com/kb/HT5622

  • LOCAL Structure to be copied from one query to another query

    Hello all,
    In our query we have created a structure locally....
    we have to copy the same locally created structure from one query to another query which is on the same multiprovider.
    We do not want to make the structure global.
    Can anyone suggest some method to achieve this!

    For copiying structures fom query to another you have to do it global. After that you can do click on right button on the structure when added to your query and choose "eliminate reference" this does further changes in the structure were local for that query.

  • Drill through from one query to another query

    Hi experts,
    Anybody knows how to do drill through from one query to another query?
    Any feedback will be really apreciated.
    Thanks.

    The setting can be done in transaction RSBBS.
    You only need to specify the sender and receiver query..
    Ashish..

  • Is it possible to update multiple tables with a dynamic form?

    I have columns from two tables populating a dynamic form. I am trying to have the form update both tables on submit. I have tried both a linked transaction and a custom transaction but I am not making progress. Only the master table is being updated. Is it possible with ADDT to update two tables with a dynamic form?

    I meant
    SXMSMSTAT
    SXMSSYERR
    Thanks.

  • Updating a table with a query that return multiple values

    Hi,
    I'm trying to update a table which contain these fields : ItemID, InventoryID, total amounts
    with a query that return these values itemId, inventoryid and total amounts for each items
    Mind you, not all the rows in the table need to be updated. only a few.
    This what i wrote but doesn't work since the query return multiple values so i can't assign it to journalAmounts.
    UPDATE [bmssa].[etshortagetemp]
    SET JournalAmounts = (SELECT sum(b.BomQty) FROM [bmssa].[Bom] b
    JOIN [bmssa].[SalesLine] sl ON sl.ItemBomId = b.BomId
    JOIN [bmssa].[SalesTable] st ON st.SalesId = sl.SalesId
    WHERE st.SalesType = 0 AND (st.SalesStatus IN (0,1,8,12,13)) AND st.DataAreaId = 'sdi'
    GROUP BY b.itemid, b.inventdimid)
    Any advise how to do this task?

    Remember that link to the documentation posted above that explains exactly how to do this. When you read it which part exactly were you having trouble with?

  • Filter query with sub query using Dropdown box

    Dear Community,
    I have 2 queries
    1. Main Query with 2 fields:  Project | Project value
    2. Sub Query with 2 fields:  Project group | Project
    Project group can be belonging to number of projects and project can be belong to number of project group (Many to Many).
    My customer wants the main query will open without any filtering.
    When I choose project group from WAD dropdown box, the main query will filtering all the projects that belong to the project group.
    I create WAD; define dropdown box as sub query, and Analysis as main query.
    In the dropdown box I choose "data binding" char and create command "set selection state by binding" (project to project) but it doesnu2019t work. 
    I also try to do this by Replacement Path in the main query, but the variable requires the attribute will be ready for input.
    Thanks a lot
    Yaniv

    I am not sure about your comments on replacement path variable. Without having tried it, here is what I would have attempted:
    The main query needs to use a replacement path variable for Project that is replaced by the results of the sub-query. Sub-query would have a regular input variable for project group. (as a quick test, if you had one analysis item for main query with variable input enabled, it should prompt you to enter Project group).
    Now the drop-down needs to be associated with a javascript function. The javascript function needs to implement command "Set variable state" for the main query data provider to selected value of the drop-down.
    The drop-down should be associated with the sub-query data provider, just used to populate the list of values in drop-down.

  • I phone software update  iphone software with another pc whit out lost my data and contacts

    my lap tap is broken and had not been able to sync my iphoe sofware; can i update my iphone sofware with another pc

    Does anyone even bother to search these forums or Google before asking questions? Apparently not...
    Anyways, yes. Connect to the new computer, open iTunes and then "Store >> Authorize Computer", then sign into the store, then "File >> Transfer Purchases". Then sync your iPhone.

  • Can I use the result of a query in another query of the same cube?

    Hello everybody;
    I have the following case. In query "A", I have used in rows a structure, whit a last formula named “Total A”, in another query "B", I need to used the result of “Total A”.
    Can anybody help me?
    Thanks in advanced.
    Mariana Serrano

    Hi Mariana,
    You can change local structures into reusable structures in any existing query by selecting the structure and, choosing Save as... from the context menu and then entering a technical name and a description in the Save Structure as... dialog box.
    You can change reusable structures that you are using in a query into local structures by selecting the structure and choosing Remove Reference from the context menu.
    Also go through this link:
    http://help.sap.com/saphelp_sem40bw/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    Best Regards,
    DMK
    *Assign point if it helps...

  • Joining a dual query to another query

    dear all;
    I am using the following syntax to get a particular user_place from a table which is joined to dual...see syntax below
    select distinct ch.user_place from table_one inner join dual on
    ch.user_place = 'TEXAS';
    which give me the following results below
    User_place
    TEXAS
    now I would like to join this result to another query that gives me the following results below.
    syntax for query 2 is
    select t2.population_id, t2.male, t2.female from table_zone;
    results from query 2
    Population Male Female
    1000 60% 40%
    so that my final result will be
    user_place Population Male Female
    TEXAS 1000 60% 40%
    Hence, can this be done. if so, how can iI do it. Thank you.

    user13046875 wrote:
    dear all;
    I am using the following syntax to get a particular user_place from a table which is joined to dual...see syntax below
    select distinct ch.user_place from table_one inner join dual on
    ch.user_place = 'TEXAS';
    which give me the following results below
    User_place
    TEXASThere's no reason to use dual above; you can simply say:
    select distinct
         ch.user_place
    from      table_one
    where     ch.user_place     = 'TEXAS'
    now I would like to join this result to another query that gives me the following results below.
    syntax for query 2 is
    select t2.population_id, t2.male, t2.female from table_zone;
    results from query 2
    Population Male Female
    1000 60% 40%
    so that my final result will be
    user_place Population Male Female
    TEXAS 1000 60% 40%
    Hence, can this be done. if so, how can iI do it. Thank you.Sure; just cross join the two:
    select distinct
         ch.user_place
    ,     t2.population_id, t2.male, t2.female
    from           table_one
    cross join     table_zone
    where     ch.user_place     = 'TEXAS'
    ;This will get the specific results you want in this specific case.
    It may get the results you want in general, too, but I can't say for sure because I don't know what the general problem is. If you'd like help, describe what you're trying to do.

  • Update several rows with single query (easy question, I guess)

    Hi all!
    I have table with two columns - name and value.
    I populate it with several sql queries:
    insert into settings (name, value) values ('company_name', 'My Company');
    insert into settings (name, value) values ('company_address', 'Company Address 12');
    insert into settings (name, value) values ('company_city', 'South Park');
    How can update rows with company_name and company_city in single query?
    Thank you in advance!

    How can update rows with company_name and company_city in single query?I guess something like this was meant:
    update settings set value = ??? where name in ('company_name ', 'company_city');But it's still unclear to me what should be used instead of question marks... :)
    Regards.

  • SQ01 - How to associate existing query with another  infoset ?

    Hello,
    I created an infoset and want to associate it with an <u>existing</u> query.
    -> I tried to change the existing query but it is blocked for changes by the user author.
    -> I tried to copy the existing query to a new query but the infoset was copied automatically
    Is it possible to do this?
    Alex,

    Hello, a query is built upon the infoset, it gets data from the infoset structure and display them in the way you have defined in the query, if you change the infoset that is below a query you might not have all the data you need in the query.
    Why not create a new query based on the othe infoset?
    Regards, Luciano.

  • Need help with another query

    Hello everyone:
    Some info on the issue: We have 2 physical warehouses on 2 different locations/cities, for transfers between warehouses/cities we created an "in-transit" warehouse for each location, material is placed on those warehouses when it's shipped and its taken out when it reaches its destination, since ALL of the material is taken out after each transfer, those "in-transit" warehouses are ussualy empty. The problem started when there were cost/price changes when material was transfered to these warehouses, so now I have more than $10K, on the account of an empty warehouse.
    I want to create query that alerts me when there is 0 (zero) inventory on X warehouse but with a balance different to 0 (zero) on the correspongding account, in other words when I have money on an empty warehouse.
    I started with a simple query to give me the total stock on a specific warehouse:
    SELECT sum(T0.OnHand)
    FROM OITW
    WHERE T0.WhsCode = 'X'
    I then created a query that gave me the warehouse code, account code, on hand and current account balance:
    SELECT T0.WhsCode, T1.AcctCode,  T2.OnHand, T1.CurrTotal
    FROM OWHS T0  INNER JOIN OACT T1 ON T0.BalInvntAc = T1.AcctCode INNER JOIN OITW T2 ON T0.WhsCode = T2.WhsCode
    WHERE T0.WhsCode = 'X'
    If I run this query on an empty warehouse I get a single line with 0 (zero) OnHand and the current account balance, but if the warehouse is not empty I get 1 line for each item that has stock on that warehouse.
    Is there a way to get only line on either case? as soon as I include the SUM(T2.OnHand) function I get an error message.
    Like I mentioned, I need to create an alert that warns me when I have "money" (balance) on an empty warehouse
    Any ideas???
    Thanks in advance
    Hugo

    Hello
    Gordon.
    I just changed
    WHERE T1.CurrTotal = 0 to WHERE T1.CurrTotal <> 0
    (since I need to be alerted when there is $$$ on the account and zero stock)
    and it worked like a charm, thanks a lot (again)
    Jesper
    I coudn't open the "Inventory Valuation Check up Service" link, I couldn't find my username and/or password (gotta look for them on my SAP emails), it seems like must contain useful info so I'll keep looking/trying.
    By the way, I may have already asked but... Is there any info regarding queries? a tutorial, guide or something? some queries have hepled me compensate some of SBO's "Areas of Oportunity", so any learning/training material would really help.
    Hugo

  • Update Problem - Join With Another Table

    I'm trying to convert few MS Access Queries into Oracle. Following is one of the query from MS Access.
    <font face="courier">
    UPDATE [RESULT] INNER JOIN [MASTER]
        ON ([RESULT].[LAST_NAME] = [MASTER].[LAST_NAME])
       AND ([RESULT].[FIRST_NAME] = [MASTER].[FIRST_NAME])
       AND ([RESULT].[DOCUMENT_NUMBER] = [MASTER].[DOCUMENT_NUMBER])
       AND ([RESULT].[BATCH_ID] = [MASTER].[LEAD_ID])
    SET [MASTER].[CLOSURE_REASON] = "Closed For Name and Document Number Match",
        [MASTER].[RESULT_ID] = [RESULT].[ID],
        [MASTER].[RESULT_PID] = [RESULT].[PID]
    WHERE (([MASTER].[CLOSURE_REASON] Is Null)
       AND ([MASTER].[REC_CODE] = "A1")
       AND ([RESULT].[EVENT_DATE] = [MASTER].[EVENT_DATE])
       AND ([RESULT].[EVENT_TYPE] = "Open")
       AND ([MASTER].[DOCUMENT_NUMBER] Is Not Null)
       AND ([MASTER].[DOCUMENT_NUMBER)] "null"));
    </font>
    First I received ORA-01779: cannot modify a column which maps to a non key-preserved table Error. I followed different examples (including MERGE) from your
    site and modified my original query. Now, I receive ORA-30926: unable to get a stable set of rows in the source tables Error.
    Most of the examples showed only one join between the tables but I have to make more joins based on my requirements.
    Any help translating this query in to Oracle would be Great. Thanks!

    Assuming that the columns you are joining to in the result table are the whole PK or are declared as aunique contraint (i.e. some combination of last_name, first_name, document_number, batch_id, event_date, id, and pid make up the entire PK/unique constraint), then the updateable join view should look something like:
    update (select m.last_name, m.first_name, m.document_number, m.lead_id,
                   m.closure_reason, m.result_id, r.id, m.result_pid, r.pid
            from master m
               join result r
                  on r.last_name = m.last_name and
                     r.first_name = m.first_name and
                     r.document_number = m.document_number and
                     r.batch_id = m.lead_id and
                     r.event_date = m.event_date
            where m.closure_reason is null and
                  m.rec_code = 'A1' and
                  r.event_type = 'Open' and
                  m.document_number is not null and
                  m.document_number != 'null')
    set closure_reason = 'Closed For Name and Document Number Match',
        result_id = id,
        result_pid = pidThe merge version would look something like:
    merge into master
       using (select last_name, first_name, document_number, batch_id,
                     event_date, id, pid
              from result
              where event_type = 'Open') r
       on (r.last_name = m.last_name and
           r.first_name = m.first_name and
           r.document_number = m.document_number and
           r.batch_id = m.lead_id and
           r.event_date = m.event_date)
       when mathed then
          update
          set closure_reason = 'Closed For Name and Document Number Match',
              result_id = id,
              result_pid = pid
          where m.closure_reason is null and
                m.rec_code = 'A1' and
                m.document_number is not null and
                m.document_number != 'null';However, as Hoek pointed out, the combination of last_name, first_name, document_number, batch_id, event_date, id, and pid must point to a unique row in the result table, whether they make up the PK or a unique constraint. If there are, or could be, multiple rows for a particular combination of last_name, first_name, document_number, batch_id, event_date, id, and pid, then you will need to find a way to determine which of those rows should be used to do the update.
    John

  • Is there an automated way to replace a query with another in a workbook?

    Hi all,
    I have a bunch of Queries which I'm planning to phase out, and I have replacement Queries for them. The Queries to be phased out are used in Workbooks. Is there an automated way to replace these obsolete Queries with new Queries in these workbooks? Maybe a BAPI, function module, VB Macro, Tcode (so that a BDC program can be written) or some other way?
    Thanks in advance
    Sankar Tadinada

    KairiTech wrote:I'm thinking of trying out Kernel Seeds.
    Kernel seeds are an excellent way to learn how to build a targeted kernel for your hardware, and I use and recommend them. They are not an automated method, which is what I understand the OP is looking for.
    (edit) yes, the information on the page is a little dated, but the methods still work. Kernel seeds are not really about faster and easier -- it's about understanding what you really need and how the process works (again, not really what the OP was asking for, but a different approach to kernel building).
    Last edited by 2ManyDogs (2013-11-25 21:51:19)

Maybe you are looking for

  • Stability issues: MSI ATI Radeon HD 6970 2048MB Twin Frozr III

    Evening all, been having some issues with my recently purchased MSI card. I'm inclined to think there is damage/issues with the video memory on the card. I did some quick research on the card and it seems that the model i have was originally a refere

  • Can't get iChat server 10.4.8 to work with iChat client on Tiger 10.4.8

    Guys/Gals I have this problem as well - I am running 10.4.8 latest updates as of today on the ol' Powerbook G4. I am setting up the iChat Server on the Xserve we have and somehow my client would not connect - they both are on the same LAN and the fir

  • Error - I have attempted to login too many times

    Anyone else had this? It asks me wait a few mins, but it has been hours now. It looks like some sort of problem with the app to me.

  • Link between spool request & abap program

    Hi all, I m looking for the link table between a spool request and the corresponding job and abap program. I want to select all spool requests generated via een job via een abap program. Some suggestions? Thanks in advance,

  • Transferring iphone photos to the pc

    I NEED TO KNOW IF ANYBODY CAN HELP ME , I NEED TO KNOW HOW TO TRANFER PICTURES FROM MY I PHONE TO COMP AND HOW TO TRANSFER PICS OR MUSIC TO THE I PHONE, IF ANYBODY CAN HELP , PLEASE. THANKS