Mirroring results from two different tables
I have one table where I have all my calculations and a total amount. I then have another table made up of just 1 cell in a different area. How do I mirror the sum of the table to this other 1 cell in the same document? I can also upload a picture so you guys can see what I'm doing.
Hi Daniel,
Here in the Mac OS Numbers version discussion area (where you posted) we don't all have a really good idea of what goes on in the iOS version of the app. That being said, you should be able to write: =Table :: Cell, where Table and Cell are table name and cell (such as A1, for instance) of the cell containing the sum in the main table.
If you can't write the expression, you can do the point and click equivalent, where you click on the source cell to insert it's address in the formula.
Jerry
Similar Messages
-
Selecting data from two different tables.
Do we need to use join two tables with primary/foreign key while trying to use select statement for getting data from those to table.? If no who can i go about do it.
872959 wrote:
If i am using From clause to get data from two different tables, is it necessary that both tables have column of identical data in them.In general, they ought to (or you need to join in a third table that tells you how to map rows from one table to rows of the other table).
It is not strictly necessary that there be any join condition between tables. If you don't provide a join condition, Oracle has to do a Cartesian product. That means that if there are n rows in one table and m rows in the other, the result set will have n * m rows. It is very rarely a good idea to write queries that do Cartesian products but it does occasionally happen.
Justin -
Sum two different columns from two different tables
Can you select and sum two different columns, from two different tables in the same sql statement?
i.e.
table1
Item----OnHand_Qty
A--------10
A--------15
B--------10
B--------10
C--------20
table2
Item----Trx_Qty
A--------2
A--------4
A--------6
B--------1
B--------1
C--------4
I'm looking for the following results from a query
Item----Sum(Onhand_Qty)---Sum(Trx_Qty)
A--------25Like this?
SQL> create table table1 (item,onhand_qty)
2 as
3 select 'A', 10 from dual union all
4 select 'A', 15 from dual union all
5 select 'B', 10 from dual union all
6 select 'B', 10 from dual union all
7 select 'C', 20 from dual union all
8 select 'D', 30 from dual
9 /
Tabel is aangemaakt.
SQL> create table table2 (item, trx_qty)
2 as
3 select 'A', 2 from dual union all
4 select 'A', 4 from dual union all
5 select 'A', 6 from dual union all
6 select 'B', 1 from dual union all
7 select 'B', 1 from dual union all
8 select 'C', 4 from dual union all
9 select 'E', 3 from dual
10 /
Tabel is aangemaakt.
SQL> select nvl(t1.item,t2.item) item
2 , t1.sum_onhand_qty
3 , t2.sum_trx_qty
4 from ( select item, sum(onhand_qty) sum_onhand_qty
5 from table1
6 group by item
7 ) t1
8 full outer join
9 ( select item, sum(trx_qty) sum_trx_qty
10 from table2
11 group by item
12 ) t2
13 on (t1.item = t2.item)
14 /
I SUM_ONHAND_QTY SUM_TRX_QTY
A 25 12
B 20 2
C 20 4
E 3
D 30
5 rijen zijn geselecteerd.Regards,
Rob. -
How to create a foreign key for the table from two different tables?
Hi All,
I have a three table like below. In the below table SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK will be having the primary key for NAME column. The same SAMPLE_CONS3_CHECK table also having the primary key for NAME column and forieign key for SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK tables. See the below code 2
code 1:
CREATE TABLE SAMPLE_CONS_CHECK
(NAME VARCHAR2(10),
SERIES VARCHAR2(5)
CREATE TABLE SAMPLE_CONS2_CHECK
(NAME VARCHAR2(5),
MODEL NUMBER
CREATE TABLE SAMPLE_CONS3_CHECK
(NAME VARCHAR2(5),
MODEL_NO NUMBER
)code 2
alter table SAMPLE_CONS_CHECK
add constraint SAMPLE_CONS_CHECK_pk primary key (NAME)
alter table SAMPLE_CONS2_CHECK
add constraint SAMPLE_CONS2_CHECK_pk primary key (NAME)
alter table SAMPLE_CONS3_CHECK
add constraint SAMPLE_CONS3_CHECK_pk primary key (NAME)
ALTER TABLE SAMPLE_CONS3_CHECK ADD
CONSTRAINT SAMPLE_CONS3_CHECK_FK1 FOREIGN KEY
NAME
) REFERENCES SAMPLE_CONS_CHECK
NAME
) ON DELETE CASCADE;
ALTER TABLE SAMPLE_CONS3_CHECK ADD
CONSTRAINT SAMPLE_CONS3_CHECK_FK2 FOREIGN KEY
NAME
) REFERENCES SAMPLE_CONS2_CHECK
NAME
) ON DELETE CASCADE;From the above schenario i am able to insert the data to SAMPLE_CONS3_CHECK table. But the parent data is already available in the parent table. The problem is here two different constarints from two different tables. While inserting, it is checking from both the tables whether the parent is exist or not.
How can i solve this problem? Can anyone halp me about this?
Thanks
Edited by: orasuriya on Aug 8, 2009 2:02 AMActually the design is completely incorrect.
What you say is
I have
'foo', 'foo series'
'foo','foo model'
'foo',666
By virtue of table3 referring to both table1 and table2.
This means you actually need to have 1 (one) table:
'foo','foo series','foo model', 666
And the 'problem' disappears.
Sybrand Bakker
Senior Oracle DBA -
Extracting unique records from two different tables record
Hello,
In the following code of two different tables www.testing.com exists in both tables. I want to compare two different columns of the two different tables to get unique records.
SQL> select unique(videoLinks) from saVideos where sa_id=21;
VIDEOLINKS
www.testing.com
SQL> ed
Wrote file afiedt.buf
1* select unique(picLinks) from saImages where sa_id=21
SQL> /
PICLINKS
test
test14
www.hello.com
www.testing.comThanks & best regardsUnfortunatly you didn't mention the expected output. I guess it would be the one line
"www.testing.com"
in that case simply join the two tables.
select *
from saVideos v
join saImages i on i.sa_id = v.sa_id and i.picLinks = v.videoLinks
where v.sa_id=21;If needed then you could change the select list to retrieve only distinct values.
select unique v.sa_id, v.videolinks
from saVideos v
join saImages i on i.sa_id = v.sa_id and i.picLinks = v.videoLinks
where v.sa_id=21;I usually avoid distinct/unique whereever possible. This requires the database to do a sort and makes the query slow.
Edited by: Sven W. on Feb 10, 2011 1:55 PM -
Query from two different tables
Hi All
I am having two different tables A and B. I want to select all rows containing the names like the rows in B.
I have tried the below and it does not work:
select * from A where name like (select '%'||name||'%' from B).
Can anyone help please.
Thanks
AmitHi Jeneesh
Thanks for the quick reply.
What i want is query to bring back all the name containing the string which is to be found in the table B.
Table A's content
Amit
Amita
Anjoo
Table B's Content
Ami
Query should return
Amit
Amita -
Can't get table field from two different tables if named same
select c.notes, o.notes
from cusomters c, orders o
:does not work in getting the RS.
:if i change database to:
select c.customer_notes, o.order_notes
from cusomters c, orders o
:then it works.
:i make PURE DYNAMIC META SQL database
applicaitons, and i need for abstract SQL tables.
i have the same problem in getting
the max values:
select
max(height),
max(weight),
max(age)
from person_stats
group by geographical_areaWhen you select from 2 different tables you need to join them on some condition, otherwise it has no idea how to associate the 2 tables together.
try select c.notes, o.notes from cusomters c, orders o where c.customer_id = o.customer.id or whatever the join fields are.
For the group by I believe you have to include the field that you group by:
select geopraphical_area, max(height), max(weight), max(age) from person_stats group by geographical_area
give them a try
Jamie -
Contatenation of columns from two different tables
Hi everyone
i have one table in following desc
table-1
str q4_currrent Q4_target
prd 500 1000
Table-2
q3_currrent Q4_target
345 1000
Table-3
percentage
50
I want the result in this format---
str q4_currrent Q4_target q3_currrent Q4_target percentage
prd 500 1000 345 1000 50
Can anyone help me how can i get this result? I want this to be done only with
query not with any procedure or function.
if you hav any query to concatenate the different tables please suggest.
thanks.
-Anandhi
thw solution which you have given that is giving the
cartesian product of all the rows of the all the 3
tables.
1st table-7 rows
2nd table-7 rows
3rd table-7 rows
total rows in result table- 343 rows.
So its not working well..
thanks for ur response.What part of
You might also want a WHERE clause if the tables have more than one row in.did you have a problem with? You provided no information on which any of us could have written a join condition. I assumed you either had only the one row you showed us, or you were planning on coding the join yourself. -
Compare 2 Columns using SSIS from two different tables
Hello,
A newbie to ssis.
I have a Table 1 with Address Details and Table 2 with Address Details of same customer but from different sources. I have loaded these two data sources and also joined these two tables.
I want to compare address column of one table with the other table, if they are not equal need to insert into another table.
With Sql query we can perform it, but just want to know how to perform this with ssis.You can use the
LookUp Transformation
Arthur
MyBlog
Twitter -
Adding two column data from two different tables.
Hi, I have two tables i want to add two column with same id and put it in third table
T1 is
id Value
1 50
2 100
3 500
4 75
T2 is
id Value
3 -20
4 80
5 -30
6 -10
I want the out put as
1 50
2 100
3 480
4 155
5 -30
6 -10
i have written
select a.id,a.value+b.value from t1 a,t2 b where a.id=b.id(+)
this is not giving me the id's from t2.select id, sum(value) from
(Select id,value from t1
union
select id ,value from t2
)group by id; -
How to create a dropdown list to list the values from two different tables?
Hi,
I have the following requirement:
1. I have to create a dropdown list to display all the values from the second column of a table.
2. Another dropdown list to display all the values from the second column of another table.
3. A text box should help me to add the selected values.
How to get this done in a PDF? Please help.
Regards,
LathaIs this a LC form? Because Acrobat forms have no concept of tables, just
individual fields... -
Getting DISTINCT count from two different columns
Hi all,
I have following query which gives currency code from two different tables. I would like to get the distinct count of currency codes from these two different columns.
SELECT eb.person_seq_id, eb.bonus_amount, eb.currency_cd, ed.currency_cd_host
FROM fr_emp_bonuses eb, fr_emp_details ed, fr_periods p
WHERE eb.person_seq_id = ed.person_seq_id AND ed.period_seq_id = eb.period_seq_id
AND ed.period_seq_id = p.period_seq_id AND p.period_status = 'CURRENT'
AND eb.bonus_amount >= 0 AND eb.person_seq_id = 3525125;
This query gives following result
3525125 240000 USD INR
3525125 0 USD INR
3525125 60000 USD INR
3525125 50000 USD INR
There are two distinct currency codes (USD, INR) and total amount is 350000. So I am looking for a query to give me the following result
3525125 350000 2
Thanks in advanceHi,
Here's one way:
WITH original_query AS
SELECT eb.person_seq_id
, eb.bonus_amount
, eb.currency_cd
, ed.currency_cd_host
FROM fr_emp_bonuses eb
, fr_emp_details ed
, fr_periods p
WHERE eb.person_seq_id = ed.person_seq_id
AND ed.period_seq_id = eb.period_seq_id
AND ed.period_seq_id = p.period_seq_id
AND p.period_status = 'CURRENT'
AND eb.bonus_amount >= 0
AND eb.person_seq_id = 3525125
, unpivoted_data AS
SELECT person_seq_id
, bonus_amount
, currency_cd
FROM original_query
UNION ALL
SELECT person_seq_id
, 0 AS bonus_amount
, currency_cd_host AS currency_cd
FROM original_query
SELECT person_seq_id
, SUM (bonus_amount) AS total_bonus_amount
, COUNT (DISTINCT currency_cd) AS distinct_currency_cds
FROM unpivoted_data
GROUP BY person_seq_id
;There may be a shorter, more efficient way to get the same results, but without knowing more about your tables, I can't tell.
The tricky thing is getting two columns (currency_cd and currencuy_cd_host in this case) counted together. You can't simply say
COUNT (DISTINCT eb.currency_cd) +
COUNT (DISTINCT ed.currency_code_host)That happens to get the correct result with the sample data you posted, but what if you had data like thEe following?
currency_cd currency_cd_host
INR USD
USD INRHere, the count of distinct currency_cds is 2, and the count of distinct currency_cd_hsots is also 2. Does that mean the grand total is 2 + 2 = 4? No, the 2 codes in one column arte the same 2 codes as in the other column. We need to get both currency_cd and currency_cd_hsot into the same column, and then do COUNT (DISTINCT ...) on that combined column. A UNION, as shown above, will certainly do that, starting with your query as you posted it. The query you posted isn't necessarily the best frist step towards this result, however, so there may be a much better approach, depending on your tables.
Edited by: Frank Kulash on Feb 1, 2012 6:21 PM
Here's a slightly shorter, and probably more efficient way to get the same results:
WITH cntr AS
SELECT LEVEL AS n
FROM dual
CONNECT BY LEVEL <= 2
SELECT eb.person_seq_id
, SUM (eb.bonus_amount) AS total-amount
, COUNT ( DISTINCT CASE
WHEN c.n = 1
THEN eb.currency_cd
ELSE ed.currency_cd_host
END
) AS distinct_currency_cds
FROM fr_emp_bonuses eb
, fr_emp_details ed
, fr_periods p
, cntr c
WHERE eb.person_seq_id = ed.person_seq_id
AND ed.period_seq_id = eb.period_seq_id
AND ed.period_seq_id = p.period_seq_id
AND p.period_status = 'CURRENT'
AND eb.bonus_amount >= 0
AND eb.person_seq_i = 3525125
-- NOTE: no join condition involving c; we really do want a cross-join
GROUP BY eb.person_seq_id
; -
Creating LOV from 2 different tables
I tried doing some searches on this, but haven't been able to find an answer. Can I create an LOV (to populate a select list) from two different tables? Both tables have the exact same column names/datatypes, just different data.
Or if this isn't possible, should I just create a new table, and then do a union query to populate it with the values from both of these tables? Just wondering if anyone's had experience with this situation. Thanks!Hmm. That is weird. Wonder why it's not working for me.
The SORT_ORDER column appears in both tables. I was hoping to be able to sort by the number value that appears in this column in both tables (could duplicate values in this table be causing an issue?).
I even tried changing it to:
SELECT DISPLAY_AS d1, CONTENT_KEY v1
FROM SER_LISTS_JOB_TYPE
WHERE ACTIVE = 'YES'
UNION
SELECT DISPLAY_AS d2, CONTENT_KEY v2
FROM SER_LISTS_COMPANY_TYPE
WHERE ACTIVE = 'YES'
ORDER BY SORT_ORDERBut still get the same error message.
Message was edited by:
taneal
OK. It appears the ORDER BY SORT_ORDER was causing the issue. I took it out and it worked. The only problem is that I have 1 duplicate entry, called "Other" that now appears twice in my LOV. Any thoughts on this? The value of CONTENT_KEY is different, but the value for DISPLAY_AS is the same. Is there anyway to pull out one of these? -
1 Graph from 2 different tables?
I'm trying to build some bar charts with two matching data sets that are in two different tables (they're big data sets). I don't want to have to copy the specific data I want from each Table into a 3rd table just to build a chart with it. Can I use data from two different tables in the same chart? i.e. the data looks like this in the chart but is in two different tables?
Table1 Table2
Data 20 25
Data 35 22
Data 36 27...
Does this question make sense? Thanks for any help.
Message was edited by: Aaron Smith6
Message was edited by: Aaron Smith6If I understand well the User Guide, we may chart datas from different tables BUT it works with rows of different tables, not with columns of different tables.
+• To add a chart based on data in more than one table, first select a single table or contiguous range of cells and create a chart, then click Charts in the toolbar, and choose a chart type. Select the chart and hold down the Command key while clicking or dragging cells in another table to add their data to the chart.+
Yvan KOENIG (from FRANCE vendredi 9 janvier 2009 21:37:41) -
Selecting from 2 different tables
is this possible?
i just want to select from two different tables in one select statement and they have the same WHERE clauseSELECT
a.pkggrp,
a.pkgtype,
a.area,
a.process,
a.ww,
count(a.ww) as LOTSGATED,
sum(a.samplesize) as SUMSAMPLESIZE,
sum(a.total_defects) as SUMTOTALDEFECTS,
sum(case a.auditresult when 'pass' then 1 else 0 end) COUNTPASS,
sum(case a.auditresult when 'fail' then 1 else 0 end) COUNTFAIL,
case sum(case a.auditresult when 'fail' then 1 else 0 end)
when 0 then 0
else round(sum(case a.auditresult when 'fail' then 1 else 0 end) / count(a.ww) * 100,2)
end LRR,
case sum(case a.auditresult when 'fail' then 1 else 0 end)
when 0 then 0
else round(sum(case a.auditresult when 'fail' then 1 else 0 end) / sum(a.samplesize) * 1000000,0)
end PPM,
count(c.itrnum)
FROM
t_prodproc_monitoring a, t_itr c
WHERE
a.ww=c.ww
and a.ww between 1 and 50
and c.ww between 1 and 50
GROUP BY
a.pkggrp,
a.pkgtype,
a.area,
a.process,
a.ww
ORDER BY
a.pkggrp,
a.pkgtype,
a.area,
a.process,
a.ww ascthis gave me a
"c". "ww": invalid identifier
Maybe you are looking for
-
Batch Characteristic not updating with result for linked MIC
Hi, I have created a MIC and linked to a batch characteristic i.e. potency and included the characteristic in a specific batch class. This MIC is part of the inspection plan for a certain material. If I generate a lot of origin 01 and 09 for the mate
-
How to change font size for my replies in "mail" app?
for the record, I tried adjusting the font size in my replies in "mail" app via general > accessibility > larger text to the largest size - yet when I clicked on reply in the mail app, the font remained small, very small. please help!
-
Photosmart C4580 won't print - push a button on printer it shuts down
The Photosmart C4580 has been reluctant lately to print anything at all. The documents sit in the spooler but won't print. I've searched for this problem here and haven't seen same printer, same issue and solution, so here goes... Dell Dimension 3000
-
I have not found any answers yet to solve this problem. Smooth Scroll Auditions CS5
I used to used Audition 3 and when recording or playing back the recorded wave form would be smooth and when it reaches the right hand edge of the screen it just smoothly continues. I have updated to Auditions CS5 and I cannot get it to do the same.
-
If my ipod locked for 22,047,982 minutes all by itself how do i fix it?
How do I fix my ipod touch if it locked itself for 22,047,982 minutes? It died and when i turned it on it said ipod is disabled for ever so many minutes... Its been like this for about two weeks and i really need it this weekend!! T