SELECT
SUM (fieldname) AS T_Withheld
,SUM (fieldname) AS G_Income
,SUM(fieldname) + SUM (fieldname) + SUM(fieldname) + SUM(fieldname) AS Premium
,SUM (fieldname) - fieldnameC - (SUM(fieldname) + SUM (fieldname) + SUM(fieldname) + SUM(fieldname)) AS T_Income
,fieldnameA
,fieldnameB
FROM tablename A
GROUP
BY fieldnameA
,fieldnameB
,fieldnamec
and
select fieldnameA, fieldnameB, fieldnameC, fieldnameD
from tablename B
Really need ideas
13 2444 code green 1,726
Recognized Expert Top Contributor
By no link do you mean there is no common field between the two tables?
If that is the case what is wrong with two select statements?
poe 32
New Member
You don't have to have a link to join tables. There should be something similar between these two tables to join on, correct?
I think it would help if you gave full, correct SQL statement(s).
ck9663 2,878
Recognized Expert Specialist
How would you know which record pairs with what record?
-- CK
I want to make only one query because i'll be using it to create a .ttx file of crystal reports to be used in vb6.
By no link do you mean there is no common field between the two tables?
If that is the case what is wrong with two select statements?
The data i need are from two tables that have nothing in common..is it impossible to create a single query on both of their fields?
How would you know which record pairs with what record?
-- CK
ck9663 2,878
Recognized Expert Specialist
Not impossible.
Would you mind posting sample data on both tables an how you want it joined?
-- CK
Sorry for the late relpy..
here is the sample of tables....
table 1
Name......Cont1..... Cont2...... Cont3.....Cont4
Name1 .....100 ......200 .........300.........400
Name2......500...... 600..........700.........800
Name3 ......900......1000........1100 ......1200
table 2
Code ......%Cont ......ContA......ContIN ..... ContFL
Code1 ...... 0 .............. 0 ........ 0 ............ 100000
Code2. ...... 5 ........... 500.........10000........30000
Code3. .......10........ ..1000........30000 ....... 70000
Code4.........15...........1500........70000 ...... .14000
ck9663 2,878
Recognized Expert Specialist
How do you want this joined? How would the joined table look?
-- CK
i just want the query of both tables, i don't want them to join or merge. i want to query them using a single query with filters.
Its like i want to compare the total values of the first table cont to the range of the values of the second.
How do you want this joined? How would the joined table look?
-- CK
code green 1,726
Recognized Expert Top Contributor
just want the query of both tables, i don't want them to join or merge. i want to query them using a single query with filters
A JOIN doesn't merge tables,
it merges results from the tables in to one recordset.
The tables are unaffected.
You want to run a query collecting results from both tables which is normally a JOIN query,
but requires common data in at least one field of each table.
Without this you could try a UNION which is two SELECT statements with UNION between.
The number of fields in each SELECT must match
ck9663 2,878
Recognized Expert Specialist
I'll give him the benefit of the doubt ;)
Based on your example, how would you do it in a pseudo-code?
-- CK
The code i have made was the one that i have posted first, but i have no idea on how to connect the two...
I'll give him the benefit of the doubt ;)
Based on your example, how would you do it in a pseudo-code?
-- CK
code green 1,726
Recognized Expert Top Contributor
We seem to be going around in circles.
The code i have made was the one that i have posted first, but i have no idea on how to connect the two
By connect I have to assume you mean JOIN.
Unfortunately YOU need to tell us how you want the tables JOINed because we do not know what you are trying to achieve.
Its like i want to compare the total values of the first table cont to the range of the values of the second
How are you hoping to do this?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Gianfranco |
last post by:
Hi
I got a problem with 2 tables.
I have a table, say A, with x records, coming from a make table query
and a table, say B, with y records, coming from another make table
query. I need to join...
|
by: deko |
last post by:
How to run action query against linked table?
I have an Access 2003 mdb with an Excel 2003 Workbook as a linked table.
When I attempt to run an action query against the linked table I get this...
|
by: Ross A. Finlayson |
last post by:
Hi,
I'm scratching together an Access database. The development box is
Office 95, the deployment box Office 2003.
So anyways I am griping about forms and global variables. Say for
example...
|
by: hmiller |
last post by:
I'm sorry to populate the server with yet another question about
linking multiple tables and queries, howerver I have not been able to
find the right criteria.
My problem.
I am trying to...
|
by: Nitin |
last post by:
I have Oracle 9.2 tables linked in Access. Data can be pulled from all
the tables except one !! It gives "ODBC connection failed" error when
trying to open the link.I deleted the link and created...
| |
by: phlype.johnson |
last post by:
I'm struggling to find the best query from performance point of view
and readability for a normalized DB design.
To illustrate better my question on whether normalized designs lead to
more complex...
|
by: steves |
last post by:
Hello All,
I am trying to link to an existing database and extend the
funcitonality by adding a phone call logging extension, so you can see
a list of phone calls for a given customer.
There...
|
by: Doris |
last post by:
It does not look like my message is posting....if this is a 2nd or 3rd
message, please forgive me as I really don't know how this site works.
I want to apologize ahead of time for being a novice...
|
by: ARC |
last post by:
Hello all,
So I'm knee deep in this import utility program, and am coming up with all
sorts of "gotcha's!".
1st off. On a "Find Duplicates Query", does anyone have a good solution for...
|
by: Sinner |
last post by:
Hi,
I have a field name 'USER' in tableMAIN.
How do I replace the user names with corresponding user names. I can
do that in xl using vlookup but now I'm trying to find a way to do
that in...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |