Populating more than one table and more than one field
I need some suggestions and this forum has always been a great source of good advice.
I have a web form at the following location: http://www.webdevpractice.com/genoptix/CE/register.php
Here's what the web form needs to do:
Send a confirmation email listing seminars the visitor checked on the form.
Create a similar message on a confirmation page.
Populate 2 two tables.
Items 1 and 2 are working fine.
The advice I need is on how to populate two tables in the database.
There are three tables:
ACCOUNTS
account_id
first_name
last_name
medtech_id
job_title
npi
company
city
state
email
phone
contact
ATTENDANCE
attendance_id
account_id
seminar_id
SEMINARS
seminar_id
seminar
speaker_first_name
speaker_last_name
date
The web form contains data that need to go into the ACCOUNTS table and the ATTENDANCE table. The challenge is getting the account_id and seminar_id into the ATTENDANCE table. If all the information was inserted properly, I could write a query that revealed who was taking what seminar.
Inserting data into the ACCOUNTS table is not a problem. I will create another form to insert information into the SEMINARS so that should not be a problem. But inserting the account_id and the seminar_id is what I am wondering about. Also, can more than one record be inserted in a table? If an user checks more that one seminar, each seminar (seminar_id) would need to be inserted in the ATTENDANCE table as separate records along with the account_id. I'm thinking I may have to do this manually. Also, the values for each seminar are their dates and titles. I used these as values to send the confirmations.
I'm just looking for advice at this point. Is this doable?
Bregent,
The table I am wondering about is the ATTENDANCE table. There are two fields in addition to the primary key: account_id and seminar_id. The field I am concern with is the seminar_id which comes from a group of checkboxs on the form. So, one form could create several records. For example, presently there are three seminars that are offered. If the visitor selects all three seminars, that would create three records in the SEMINARS table. So, it might look like this:
attendance_id account_id seminar_id
1 1 1
2 1 2
3 1 3
My PHP skills are basic. I've done other forms and use PHP in other ways. But I have never had to populate several rows in one table with an array of checkboxes nor have I be able to find an example of this.
So the advice I am seeking (and perhaps this is premature) is this:
Can one field from a table populate more than one record?
Should I set up checkboxs as a group or individually with a different name?
I am also considering setting up my tables differently so there is a table from each seminar--that may solve my problem.
Similar Messages
-
How to display contents of one table and update another one
Hi all
My requirement is the following:
- Three tables, guard, site and guard_site where guard_site shows which guards are linked to a particular site and vice-versa
- I need to create one front-end where i allow all guards to be linked with a particular site
- so the panel must show all guards available (so get display data from guard table) and then i need to introduce a row selector, which allows user to select whichever guards he/she wants
- There will be a save button and upon pressing it, i will create an entry on the guards_site table for the selected guards against the siteId provided when user goes to this page.
- Also upon loading this page if there are already any linked guards these must show as ticked in the row selector.
so I first attempted using a Tabular form or a form on a table/view, but it then forces me to select a table to update, which is not what i want, the data i display is from guard table, which is not the table i want to update... so I then tried a blank page and I created a SQL Query report region... but it doesn't allow me to add a row selector (even if I have added a button on the region).
Any ideas?
Regards and thanks
Jose
Ps- im using version Application Express 4.0.2.00.09 that came with Oracle Database Express Edition 11gJose,
Three tables, guard, site and guard_site where guard_site shows which guards are linked to a particular site and vice-versaso I first attempted using a Tabular form or a form on a table/view, but it then forces me to select a table to update, which is not what i want, the data i display is from guard table, which is not the table i want to update...>
Maybe I am not understanding what you are trying to do but it appears that the table guard_site is the table you should be updating. Doesn't the guard_site table contain foreign keys from both the guard and site tables?
Jeff -
Linking One table with more then one tablespace
Hi,
Can anybody help to link one table to more then one tablespace?
Thanks in advance.If the table is not partitionned you cannot store a table in different tablespaces. If the table is partitionned you can store each partition in a different tablespace. Example from 10.2 Data Warehousing Guide:
CREATE TABLE sales_composite
(salesman_id NUMBER(5),
salesman_name VARCHAR2(30),
sales_amount NUMBER(10),
sales_date DATE)
PARTITION BY RANGE(sales_date)
SUBPARTITION BY HASH(salesman_id)
SUBPARTITION TEMPLATE(
SUBPARTITION sp1 TABLESPACE ts1,
SUBPARTITION sp2 TABLESPACE ts2,
SUBPARTITION sp3 TABLESPACE ts3,
SUBPARTITION sp4 TABLESPACE ts4)
(PARTITION sales_jan2000 VALUES LESS THAN(TO_DATE('02/01/2000','MM/DD/YYYY'))
PARTITION sales_feb2000 VALUES LESS THAN(TO_DATE('03/01/2000','MM/DD/YYYY'))
PARTITION sales_mar2000 VALUES LESS THAN(TO_DATE('04/01/2000','MM/DD/YYYY'))
PARTITION sales_apr2000 VALUES LESS THAN(TO_DATE('05/01/2000','MM/DD/YYYY'))
PARTITION sales_may2000 VALUES LESS THAN(TO_DATE('06/01/2000','MM/DD/YYYY')));Edited by: P. Forstmann on 13 févr. 2010 09:08 -
How to insert some records in one table and some records in another table
Interview question
how insert records in two tables by using trigger
CREATE or REPLACE TRIGGER Emp_Ins_Upd_Del_Trig
BEFORE delete or insert or update on EMP
FOR EACH ROW
BEGIN
if UPDATING then
UPDATE emp2
SET
empno = :new.empno,
ename = :new.ename
--, job = :new.job
--, mgr = :new.mgr
--, hiredate = :new.hiredate
, sal = :new.sal
--, comm = :new.comm
--, deptno = :new.deptno;
sdate = :new.sdate,
edate = :new.edate
end if;
if INSERTING then
INSERT INTO emp2
VALUES
( :new.empno
, :new.ename
--, :new.job
--, :new.mgr
--, :new.hiredate
, :new.sal
--, :new.comm
--, :new.deptno
new.sdate,
new.edate);
end if;
if DELETING then
DELETE FROM emp2
WHERE empno = emp2.empno;
end if;
END;
it is working fine but he wants to insert some specific litimit on one table and some specified limit of records in one ..
In this senerio can i insert records by use count of records...
please help me..Can you be more specific on the "Limit"
Conditional insert can be used in this case. -
On submit perform an insert on one table and an update on aother table
I am trying to perform and insert on the table one table (the wizard created my form the insert is going against the table that I created using the wizard) and on the form is on field that is also in another table. Therefore, I am trying to perform an update on one attribute of one table and a insert into another table. How do I do this in apex?
If you have used wizard to create form, then you may see a process of type 'Automatic Row Processing (DML)' in your page which will perform INSERT/UPDATE/DELETE on your form table. Here you can see APEX performs INSERT only when REQUEST is in 'INSERT, CREATE, CREATE_AGAIN, CREATEAGAIN'
So create one more PL/SQL page process which will execute at 'on Submit after validations' and write update process as follows
begin
-- pseudo table/columns
update tbl_second
set col1 = :p1_item
where pk_col = :p1_pk_item;
end;Make this process conditional so that it will perform UPDATE only when request value is in 'INSERT, CREATE, CREATE_AGAIN, CREATEAGAIN' ( i.e. only when you are inserting into your form table)
Cheers,
Hari
p.s. I think you may also need to update the second table when some-one updates your form table.
Edited by: Hari_639 on Oct 26, 2009 9:46 AM -
How to get the data from one table and insert into another table
Hi,
We have requirement to build OA page with the data needs to be populated from one table and on save data into another table.
For the above requirement what the best way to implement in OAF.
I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
ThanksYou can achieve this in many different ways, one is
1. Create another VO based on the EO which is based on the dest table.
2. At save, copy the contents of the source VO into the dest VO (see copy routine in dev guide).
3. commiting the transaction will push the data into the dest table on which the dest VO is based.
I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
if by table you mean a DB table, then no, you can have a VO based on multiple EOs which will do DMLs accordingly.Thanks
Tapash -
Capture from Two Tables and Apply in one Table
Hi All,
Is it possible to capture from two tables (master and child table) and apply in one table?
For example,
1. DEPT and EMP tables in source database with relation
DEPT table structure is like DEPT_ID, DEPT_NAME, LOC_NAME
EMP table structure is like EMP_ID, EMP_NAME, EMP_DOJ, EMP_SAL, DEPT_ID
2. EMP_DEPT_STAGING in destination database
EMP_DEPT_STAGING table structure is like EMP_ID, EMP_NAME, EMP_DOJ, EMP_SAL, DEPT_ID. DEPT_NAME, LOC_NAME
if there is any update in DEPT table, EMP_DEPT_STAGING should get populated with Department and its employee details. Similarly, if there is any update in EMP table EMP_DEPT_STAGING table should get populated with Employee details and along with department detail.
Is it possible to accomplish this? If yes, could you please provide me some examples?
Thanks & Regards
Thiyagu
Edited by: mt**** on Sep 4, 2011 11:22 PMlike this
INSERT @PlantNew (PlantID, PlantName, PlantDirExists, PlantAssistantDirID, PlantDirID)
SELECT p.PlantID,
p.PlantName,
CASE WHEN pd.PlantID IS NULL THEN 0 ELSE 1 END,
PlantAssistantDirID,
PlantDirID
FROM @Plant p
LEFT JOIN (SELECT PlantID,
MAX(CASE WHEN Assistant = 1 THEN PlantDirectorID END) AS PlantAssistantDirID,
MAX(CASE WHEN Assistant = 0 THEN PlantDirectorID END) AS PlantDirID
@PlantDirector
GROUP BY PlantID)pd
ON pd.PlantID = p.PlantID
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
You're missing a FROM
insert into @PlantNew
SELECT p.PlantID,
p.PlantName,
CASE WHEN pd.PlantID IS NULL THEN 0 ELSE 1 END,
PlantAssistantDirID,
PlantDirID
FROM @Plant p
LEFT JOIN (SELECT PlantID,
MAX(CASE WHEN Assistant = 1 THEN PlantDirectorID END) AS PlantAssistantDirID,
MAX(CASE WHEN Assistant = 0 THEN PlantDirectorID END) AS PlantDirID
from @PlantDirector
GROUP BY PlantID)pd
ON pd.PlantID = p.PlantID -
Insert one table and update another???
Hello,
I was wondering if it is possible to insert a record in one table and update another another record in a different table.
I have a form on my company's intranet that allows employees to add comments (ADDT Insert transaction) about new products we are going to bring to the market. At the same time, I would like to count the numbers of comments on a particular product and update that number for each product to see which product is getting the most reviews.
Right now the products are on the homepage with the title and inserted date. From there, the employees click on the product get the info and make comments about it. The problem for me is that I would like to see the comment counts for each product on the home page, which means I would have to update the product table with the count.
Sorry, I am using PHP as the technology.
When I used to do it in ASP, I would insert the comment using the POST from the form, but add another hidden field with the count in it and I would use the "Command" Server behavior to retrieve the number and update the other table field.
I noticed that dreamweaver removed the "Command" server behavior when using PHP.
All help is greatly appreciated
Charles.Hi Charles,
you can generally execute queries on a different table using Custom Triggers, and in regards to your "update the product table with the count" scenario the ADDT help file has a helpful pointer in the chapter "Custom transactions and triggers : Save additional information on login" -- in here you´ll find a sample "incremental counter" query which should be easy to adapt.
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
How to join fields from different internal tables and display into one int
hai i have one doubt...
how to join fields from different internal tables and display into one internal table..
if anybody know the ans for this qus tell me......hii
you can read data as per condition and then can join in one internal table using READ and APPEND statement..refer to following code.
SELECT bwkey " Valuation Area
bukrs " Company Code
FROM t001k
INTO TABLE i_t001k
WHERE bukrs IN s_bukrs.
IF sy-subrc EQ 0.
SELECT bwkey " Valuation Area
werks " Plant
FROM t001w
INTO TABLE i_t001w
FOR ALL ENTRIES IN i_t001k
WHERE bwkey = i_t001k-bwkey
AND werks IN s_werks.
IF sy-subrc EQ 0.
LOOP AT i_output INTO wa_output.
READ TABLE i_t001w INTO wa_t001w WITH KEY werks = wa_output-werks.
READ TABLE i_t001k INTO wa_t001k WITH KEY bwkey = wa_t001w-bwkey.
wa_output-bukrs = wa_t001k-bukrs.
MODIFY i_output FROM wa_output.
CLEAR wa_output.
ENDLOOP. " LOOP AT i_output
ENDIF. " IF sy-subrc EQ 0
regards
twinkal -
Insert into one table, update another with one form
Does anyone know how to do this?
I'm writing a small system where I need to have a master project record in one table, and small little project events in a sub notes table. I want to be able to insert a record with notes into the sub table and update the status in the master table -- all from one form.
Any thoughts would be very, very appreciated :) -LRHi Lee,
in case your main Insert transaction provides a value which can be used to identify the master table´s primary key, I think you should set up a Custom Trigger to update a specific record in the master table.
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
ABAP/BASIS: Copying one table & its data from one client to another
Hi Gurus,
Is it possible to copy or importing one table and it's data into another client? If yes please advise me.
Thanks
ShivHi,
You can do this thru your program itself, by using
the CLIENT-SPECIFIED keyword in addition to you
INSERT statement.
This addition deactivates the automatic client handling of Open SQL.
If the addition CLIENT SPECIFIED is used,
the client identifier specified in source is taken into account.
Without the addition CLIENT SPECIFIED, the ABAP runtime environment
does not transfer the client identifier specified in source
to the database system,
but transfers the identifier of the current client instead.
Regards,
Samson Rodrigues. -
More Than One Website and More Than One Column
Hi. I have two questions.
1. I have two websites on my iWeb - one for me and one for a company I'm making a website for. I only want to upload the one for me onto my .Mac account, but I don't want to delete the other site. How do I get only one site uploaded without deleting one?
2. How do I have my text box divided into two columns? I don't want to wind up with a rather long list of items.
Thank you.Andlabs,
How do I get only one site uploaded without deleting one?
Separate your sites into individual Domain files. Instructions for this can be found here.
How do I have my text box divided into two columns?
iWeb is no where near Word when it comes to handling text; in fact, it is frustratingly inept. My suggestion would be to use multiple text boxes placed next to one another; you can eliminate the lines that define the text boxes in Inspector, which will give a good 'illusion' of columns. (Stroke/none).
Mark -
Global Temporary Table (and more)
Hi every one,
here's the scenario:
My database version is Oracle 9i.
I have two Global Temporary Tables (GTT). I want to insert into those two tables (using a SELECT statement for each table) and then to use a SELECT statement to select from the two tables and the result sent to Report Builder 6i.
Now, i guess i could use a Stored Procedure (SP) to insert into those tables and then use a SYS_REFCURSOR to return from this SP. The problem with that is Report Builder 6i does not recognise SYS_REFCURSOR types; it requires actual rows to be returned.
So, my question is:
Is there any way to insert into the two GTT first (using Select statements with Insert) and then select from the two tables, all in a single SELECT statement(In any case, a statement must be present that returns actual rows)?
Additionally, one may run the report more than once (not necessarily after issuing a COMMIT or logging out), which means, the two GTT will be filled again and again. So, i will have to Truncate the GTT every time before Inserting.
Efficiency of the query/solution is very important too as the data involved can consist of up to 2,00,000 records.
Any suggestions will be greatly appreciated.
Thank u.Here is some more detail:
Q1////This statement handles INSERT for one GTT. Data inserted consists of multiple data selected from tables other than POLICY which is used by stored proc MANPOWER (in Q2).
INSERT INTO TEMP1_NewBusiness
SELECT ORG1, ORG2, (SELECT NAME FROM ORGANISER WHERE CODE=ORG1), ...,
FROM POLICY
WHERE DATCOM = '2007';
Q2////This handles INSERT for second GTT
INSERT INTO TEMP2_MANPOWER
SELECT ORG1, MANPOWER(ORG1)
FROM TEMP1_NewBusiness;
/////Table POLICY is a normal table.
MANPOWER is a stored proc which performs a string aggregation, using a cursor, by selecting from TEMP1.NBS. Because of the volume of data involved and the number of Selects, i'm using the GTT TEMP1.NBS as source for Manpower's data.
So, first i need these two statements to be executed so that my GTTs are filled.
Next, i want the result of query below sent to Report Builder.
Q3.
SELECT A.ORG1, A.ORG2, ..., B.MANPOWER
FROM TEMP1.NewBusiness A, TEMP2.MANPOWER B
WHERE A.ORG1 = B.ORG1;
Now, i could place Q3 in the Report, but how do i get Q1 and Q2 to be executed first.
Hope the situation is a little more clear now.
I understand where you are coming from DAMORGAN and duplication is something i want to avoid myself.
Thank u. -
How to combine multiple fact tables and dimensions in one worksheet?
Hello Forum,
I am encountering a reporting problem when trying to create a worksheet that uses more than one cube/fact table and common dimensions. I have used Oracle Warehouse Builder 10Gr2 to design and deploy a pretty simple ROLAP data mart. We are using Discoverer Plus for OLAP as our reporting tool. We have 5 dimension tables using a star schema and 3 fact tables, when I create the worksheet I bring in our sales measure from our sales item table and then Store_Name from my Stores Dimension and then day from my time dimension, everything looks good at the stage, we're just trying to get a sum of all sales for that store on that day. Then I bring in a measure from our advertising cost table and a join window pops up asking which join to use, if I choose either the Store or the Time dimension I get correct data for the first fact table (sales) and grossly incorrect data for the ad cost measure from the second fact table (advertsing costs)...... any help would be appreciatedYou have encountered one of the key limitations of Discoverer... which I complained about to the Discoverer product manager at OpenWorld in 2001....
Anyhow, to get around this, you are going to have to deal with it either in the database, (views, materialized views, tables), or within the admin tool by creating a custom folder.
Discoverer also calls this the "fan trap", but never really had a solution to the problem. [The solution only worked is you joined to one and only one dimension!]
What you want (using Sales_Fact and Inventory_Fact as an example) is to join Sales to Time, Store, and Product, and save that result. Then join Inventory to Time, Store, and Product, save that result, then do a double outer join between the two intermediate temporary tables in order to calculate something useful like inventory turns by store and product line.
This is also known a "multipass SQL", and is supported by some (but not many) other tools.
So, to accomplish this with Discoverer, you'll either need to create a view, or table, or materialized view that has already put Sales and Inventory into a single (virtual?) fact table. Alternatively you can write the SQL for how to do this linkage (don't forget to handle missing data), and use the Discoverer admin tool to create a custom folder that uses your SQL.
Hope this helps! -
I want to enter information in one table and have it update other tables automatically
I am a very unlearned Numbers user.
Here is my desire/dilemma. I run a summer camp and have to record information for our camp. I use the information in a number of forms from check in and check out to records for each cabin, and more.
I would like to create a master table that has all of the information for each camper that I will call a master list. I then want to create the tables that will contain the information needed for each specific form. I want the specific forms to be able to update automatically when new information is entered in the master. The master record will be sorted by the cabin and bed numbers, so I can tie the subtables to those cells, but I need the row to update as well.
My question is how can I do this in the shortest and simplest way possible?
I hope this question is clear.
Thanks!
RoyHi Roy,
Well, the simplest is likely to sort the Master table by Cabin number, then use copy/paste to transfer the information to the separate tables for each cabin. But that's not automatic.
Before jumping in to this, I'd like a better idea of what your Master table will look like, what one of the sub-tables would look like, and which data you want to transfer from the Master to the Subs. A screen shot would be helpful to anyone trying to help you with this, not just to me.
One consideration is how you will use the sub-tables. An immediate difficulty that comes to mind if you are goiing to mix retrieved data and directly recorded data on the same table is that data collected from the Master table and data recorded directly on one of the sub tables are independent of each other. Consider the list below:
1 Bob Baines
2 Chuck Clay
2 Dexter Davis
3 Ed Elmore
1 Frank Fencepost
1 Greg Gilson
3 Harvey Hall
Bob, Chuck and Frank would appear (in that order) on the Cabin 1 list:
Bob x √ √ √
Frank √ √ √ √
Greg √ x x √
But if Chuck, for some reason, was transferred to cabin 1:
1 Bob Baines
1 Chuck Clay
2 Dexter Davis
3 Ed Elmore
1 Frank Fencepost
1 Greg Gilson
3 Harvey Hall
That transfer would affect only the data collected from the Master table. The data entered directly would remain where it was when entered, with disastrous results to Frank's (so far) perfect attendance record.
Bob x √ √ √
Chuck √ √ √ √
Frank √ x x √
Greg
Regards,
Barry
Maybe you are looking for
-
Same account, different computers...
Hi, I use my iTunes account on my MacBook and on someone elses laptop. If she downloads apps on her laptop, can I also have them on my MacBook? It's doesn't show in the 'Purchased' tab in iTunes, however it does show in my recently purchased bit in m
-
How do I interpret multiple footage files at the same time in AME CC?
I have about 50 ProRes QT files that I need to transcode. But AME CC is seeing them as Square and I need to set them all as D1. When I select all my files in the Qeue and go to interpret footage, the option is grayed out. I'm running on Mac OS X 10.7
-
File Sender with CC Error handling
When using the file sender with content conversion we often receive Parsing errors in the AFW monitoring due to bad messages. Q: how can we monitor and e-mail this errors from the AFW,does the CCMS covers everything? Alert monitoring?. another Q: In
-
How to replace string containing special characters by another string
Hi all, I have to Search for a pattern and replace it by a substitute pattern [Eg: Replace methodOrig (a,b) with SessTime = getSessionParameter(time); methodNew(a,b,SessTime) ] in files. i tried this using replace(),but it din't work since string1
-
Iook above