473,837 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

aligning multiple query results

I'm trying to pull data from 2 different tables and do a loop to
retrieve more than one row. I'm having problems with aligning the
information. Can someone lead me in the right direction? I've done some
looking myself and found something called GROUP BY? Is that what I need
to use? Thanks in advance.

Jan 7 '06
28 2254

David Haynes wrote:
Jerry Stuckle wrote:
kiqyou_vf wrote:
I'm trying to pull data from 2 different tables and do a loop to
retrieve more than one row. I'm having problems with aligning the
information. Can someone lead me in the right direction? I've done some
looking myself and found something called GROUP BY? Is that what I need
to use? Thanks in advance.


Sorry, my mind reading isn't working this morning.

It's impossible to tell without knowing the structure of your tables,
the code you're using and the output you expect.

Sounds more like a UNION problem, but Jerry is right. We need more
information to make reasonable comments.

-david-

I have a page that displays multiple search results. On each search
result I want unique information from two or more tables to be
displayed. All tables have a "client_id" column. I need the main query
to display results based on the $_GET['keywords'] and a second table to
display results based on the "client_id" of the main query. I don't
have any code as of yet to show you. I have done some research on UNION
and found this on mysql.com:

"Selected columns listed in corresponding positions of each SELECT
statement should have the same type. (For example, the first column
selected by the first statement should have the same type as the first
column selected by the other statements.) The column names used in the
first SELECT statement are used as the column names for the results
returned."

Is this going to be a problem since the names and information are going
to be different on each of my tables.

Jan 9 '06 #11
I have a page that displays multiple search results. On each search
result I want unique information from two or more tables to be
displayed. All tables have a "client_id" column. I need the main query
to display results based on the $_GET['keywords'] and a second table to
display results based on the "client_id" of the main query. I don't
have any code as of yet to show you. I have done some research on UNION
and found this on mysql.com:

"Selected columns listed in corresponding positions of each SELECT
statement should have the same type. (For example, the first column
selected by the first statement should have the same type as the first
column selected by the other statements.) The column names used in the
first SELECT statement are used as the column names for the results
returned."

Is this going to be a problem since the names and information are going
to be different on each of my tables.

Jan 9 '06 #12
I have a page that displays multiple search results. On each search
result I want unique information from two or more tables to be
displayed. All tables have a "client_id" column. I need the main query
to display results based on the $_GET['keywords'] and a second table to
display results based on the "client_id" of the main query. I don't
have any code as of yet to show you. I have done some research on UNION
and found this on mysql.com:

"Selected columns listed in corresponding positions of each SELECT
statement should have the same type. (For example, the first column
selected by the first statement should have the same type as the first
column selected by the other statements.) The column names used in the
first SELECT statement are used as the column names for the results
returned."

Is this going to be a problem since the names and information are going
to be different on each of my tables.

Jan 9 '06 #13
I have a page that displays multiple search results. On each search
result I want unique information from two or more tables to be
displayed. All tables have a "client_id" column. I need the main query
to display results based on the $_GET['keywords'] and a second table to
display results based on the "client_id" of the main query. I don't
have any code as of yet to show you. I have done some research on UNION
and found this on mysql.com:

"Selected columns listed in corresponding positions of each SELECT
statement should have the same type. (For example, the first column
selected by the first statement should have the same type as the first
column selected by the other statements.) The column names used in the
first SELECT statement are used as the column names for the results
returned."

Is this going to be a problem since the names and information are going
to be different on each of my tables.

Jan 9 '06 #14
I have a page that displays multiple search results. On each search
result I want unique information from two or more tables to be
displayed. All tables have a "client_id" column. I need the main query
to display results based on the $_GET['keywords'] and a second table to
display results based on the "client_id" of the main query. I don't
have any code as of yet to show you. I have done some research on UNION
and found this on mysql.com:

"Selected columns listed in corresponding positions of each SELECT
statement should have the same type. (For example, the first column
selected by the first statement should have the same type as the first
column selected by the other statements.) The column names used in the
first SELECT statement are used as the column names for the results
returned."

Is this going to be a problem since the names and information are going
to be different on each of my tables.

Jan 9 '06 #15
I have a page that displays multiple search results. On each search
result I want unique information from two or more tables to be
displayed. All tables have a "client_id" column. I need the main query
to display results based on the $_GET['keywords'] and a second table to
display results based on the "client_id" of the main query. I don't
have any code as of yet to show you. I have done some research on UNION
and found this on mysql.com:

"Selected columns listed in corresponding positions of each SELECT
statement should have the same type. (For example, the first column
selected by the first statement should have the same type as the first
column selected by the other statements.) The column names used in the
first SELECT statement are used as the column names for the results
returned."

Is this going to be a problem since the names and information are going
to be different on each of my tables.

Jan 9 '06 #16
I have a page that displays multiple search results. On each search
result I want unique information from two or more tables to be
displayed. All tables have a "client_id" column. I need the main query
to display results based on the $_GET['keywords'] and a second table to
display results based on the "client_id" of the main query. I don't
have any code as of yet to show you. I have done some research on UNION
and found this on mysql.com:

"Selected columns listed in corresponding positions of each SELECT
statement should have the same type. (For example, the first column
selected by the first statement should have the same type as the first
column selected by the other statements.) The column names used in the
first SELECT statement are used as the column names for the results
returned."

Is this going to be a problem since the names and information are going
to be different on each of my tables.

Jan 9 '06 #17
I have a page that displays multiple search results. On each search
result I want unique information from two or more tables to be
displayed. All tables have a "client_id" column. I need the main query
to display results based on the $_GET['keywords'] and a second table to
display results based on the "client_id" of the main query. I don't
have any code as of yet to show you. I have done some research on UNION
and found this on mysql.com:

"Selected columns listed in corresponding positions of each SELECT
statement should have the same type. (For example, the first column
selected by the first statement should have the same type as the first
column selected by the other statements.) The column names used in the
first SELECT statement are used as the column names for the results
returned."

Is this going to be a problem since the names and information are going
to be different on each of my tables.

Jan 9 '06 #18
I have a page that displays multiple search results. On each search
result I want unique information from two or more tables to be
displayed. All tables have a "client_id" column. I need the main query
to display results based on the $_GET['keywords'] and a second table to
display results based on the "client_id" of the main query. I don't
have any code as of yet to show you. I have done some research on UNION
and found this on mysql.com:

"Selected columns listed in corresponding positions of each SELECT
statement should have the same type. (For example, the first column
selected by the first statement should have the same type as the first
column selected by the other statements.) The column names used in the
first SELECT statement are used as the column names for the results
returned."

Is this going to be a problem since the names and information are going
to be different on each of my tables.

Jan 9 '06 #19
I have a page that displays multiple search results. On each search
result I want unique information from two or more tables to be
displayed. All tables have a "client_id" column. I need the main query
to display results based on the $_GET['keywords'] and a second table to
display results based on the "client_id" of the main query. I don't
have any code as of yet to show you. I have done some research on UNION
and found this on mysql.com:

"Selected columns listed in corresponding positions of each SELECT
statement should have the same type. (For example, the first column
selected by the first statement should have the same type as the first
column selected by the other statements.) The column names used in the
first SELECT statement are used as the column names for the results
returned."

Is this going to be a problem since the names and information are going
to be different on each of my tables.

Jan 9 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
6222
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to make it better soon. Unfortunately, there is never a non-crucial time in which we can do an upgrade, so we are stuck for now. Point 1: There are multiple tables: students, courses, cross-reference
4
16761
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from customers; I can execute each statement individually but get the 'you have an error in
3
7757
by: Gord | last post by:
I would like to create a summary report from the results of 11 queries (based on 2 tables). All the queries have the same format and return 3 numbers (Count, Current Year Bal, Last Year Bal.) under different conditions. When I use the Report Wizard to select multiple queries to be included in my report, I got an error msg. It says "You have chosen fields from record sources which the wizard can't connect. You may have chosen fields...
2
15074
by: Scott Cannon | last post by:
I am trying to query 3 tables all related by Clinet_ID. The Clients table, Monthly_Expenses table and Monthly_Income table. Each client can have 0>M instances of expenses, past due expenses, and income so I am using the SUM aggregate function to get the totals for the Monthly_Epenses.Amount, Monthly_Expenses.Past_Due_Amount, and Monthly_Income.Amount. Then problem I am having and cannot seem to resolve is that the Monthly_Income is...
5
5674
by: Beacher | last post by:
I've noticed that you can only have a sub datasheet pointing to one table... is there anyway to change this? for example I have Customer | ---------- Customer/Product | ----------- Customer Grp/Sales Grp
1
1544
by: kiqyou_vf | last post by:
Sorry, Google wouldn't let me post a reply. Here is the convo thus far: Jerry Stuckle wrote: > kiqyou_vf wrote: >> I'm trying to pull data from 2 different tables and do a loop to >> retrieve more than one row. I'm having problems with aligning the >> information. Can someone lead me in the right direction? I've done some >> looking myself and found something called GROUP BY? Is that what I need >> to use? Thanks in advance.
1
2856
by: Barb.Richards | last post by:
I have created an append query that pulls information from one database, and will append the selected information into a new table. The fields are setup like 'number' 'category' 'code' 'shares' and 'dollars'. Using the "backend" of this table I can filter the numbers by right clicking and using Filter For: then enter 1 or 2 or 3 and this will return results for all information that has 1 or 2 or 3 as a number. However, the problem I...
1
6290
by: tjm0713 | last post by:
Not sure this can be done but here is my current situation. I have a table containing millions of records. Each record has 28 fields. One of the fields I am trying to return the single record for is Res_code. There can be multiple records with the same Res_code. Some of the matching Res_code records can have different values in any of the 28 fields and some may have exactly the same value in each field. Example: Res_Id ...
0
9853
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9696
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10644
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7827
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7014
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4482
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3131
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.