473,480 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

query help needed

JT
Hello all, I've been using sql and mysql in particular for several
years now, but I'm having some trouble coming up with a query that
will pull the data that I need from a mysql table without using
multiple queries. Here's what I'm attempting to do:

Table1

column1-a, column2-a, column3-b, column4-b, column5-c, column6-c

in this example, each the table is storing 2 values for one record,
and this had to be done in one table, at the time. I could
re-structure the database, but if there exists a query to fit my needs
I would rather do that.

I need to search the first column in each pair and if it has a
matching value to what I'm searching for pull the second column in the
pair so I can generater a report from that data. I hope this is
enough information for anyone who wishes to make a recommendation. Is
it possible to accomplish this on one query?

Thanks
Jul 19 '05 #1
6 1375
> Hello all, I've been using sql and mysql in particular for several
years now, but I'm having some trouble coming up with a query that
will pull the data that I need from a mysql table without using
multiple queries. Here's what I'm attempting to do:

Table1

column1-a, column2-a, column3-b, column4-b, column5-c, column6-c

in this example, each the table is storing 2 values for one record,
and this had to be done in one table, at the time. I could
re-structure the database, but if there exists a query to fit my needs
I would rather do that.

I need to search the first column in each pair and if it has a
matching value to what I'm searching for pull the second column in the
pair so I can generater a report from that data. I hope this is
enough information for anyone who wishes to make a recommendation. Is
it possible to accomplish this on one query?


WHAT?? :) sorry i really don't understand what you want...
is there only one table?
with 6 columns?
what pair???

chris
Jul 19 '05 #2
> Hello all, I've been using sql and mysql in particular for several
years now, but I'm having some trouble coming up with a query that
will pull the data that I need from a mysql table without using
multiple queries. Here's what I'm attempting to do:

Table1

column1-a, column2-a, column3-b, column4-b, column5-c, column6-c

in this example, each the table is storing 2 values for one record,
and this had to be done in one table, at the time. I could
re-structure the database, but if there exists a query to fit my needs
I would rather do that.

I need to search the first column in each pair and if it has a
matching value to what I'm searching for pull the second column in the
pair so I can generater a report from that data. I hope this is
enough information for anyone who wishes to make a recommendation. Is
it possible to accomplish this on one query?


WHAT?? :) sorry i really don't understand what you want...
is there only one table?
with 6 columns?
what pair???

chris
Jul 19 '05 #3
> Hello all, I've been using sql and mysql in particular for several
years now, but I'm having some trouble coming up with a query that
will pull the data that I need from a mysql table without using
multiple queries. Here's what I'm attempting to do:

Table1

column1-a, column2-a, column3-b, column4-b, column5-c, column6-c

in this example, each the table is storing 2 values for one record,
and this had to be done in one table, at the time. I could
re-structure the database, but if there exists a query to fit my needs
I would rather do that.

I need to search the first column in each pair and if it has a
matching value to what I'm searching for pull the second column in the
pair so I can generater a report from that data. I hope this is
enough information for anyone who wishes to make a recommendation. Is
it possible to accomplish this on one query?


WHAT?? :) sorry i really don't understand what you want...
is there only one table?
with 6 columns?
what pair???

chris
Jul 19 '05 #4
JT
Yeah, I figured that would be confusing.

This is all in one table. In the example I wrote out, there are 6
columns in that table, each divided into corresponding data elements,
this has nothing to do with the database structure itself, just how
the data was organized by the person who created the table.

I need to be able to check through the first of each pair, like you
normally write:

select field_2 from table_name where field_1 = 'data';

where field_1 is the first column of each pair within one row of a
table and field_2 is the second.

My problem is that I don't know if SQL can do this in one statement,
I'm currently accomplishing it with 2 or more depending on the
circumstance, but would like to get it down to one if possible.

Does that help at all?

Thanks for checking this out,

JT

Christian Meisinger <c.*********@livingliquid.com> wrote in message news:<op**************@news.inode.at>...
Hello all, I've been using sql and mysql in particular for several
years now, but I'm having some trouble coming up with a query that
will pull the data that I need from a mysql table without using
multiple queries. Here's what I'm attempting to do:

Table1

column1-a, column2-a, column3-b, column4-b, column5-c, column6-c

in this example, each the table is storing 2 values for one record,
and this had to be done in one table, at the time. I could
re-structure the database, but if there exists a query to fit my needs
I would rather do that.

I need to search the first column in each pair and if it has a
matching value to what I'm searching for pull the second column in the
pair so I can generater a report from that data. I hope this is
enough information for anyone who wishes to make a recommendation. Is
it possible to accomplish this on one query?


WHAT?? :) sorry i really don't understand what you want...
is there only one table?
with 6 columns?
what pair???

chris

Jul 19 '05 #5
JT
Yeah, I figured that would be confusing.

This is all in one table. In the example I wrote out, there are 6
columns in that table, each divided into corresponding data elements,
this has nothing to do with the database structure itself, just how
the data was organized by the person who created the table.

I need to be able to check through the first of each pair, like you
normally write:

select field_2 from table_name where field_1 = 'data';

where field_1 is the first column of each pair within one row of a
table and field_2 is the second.

My problem is that I don't know if SQL can do this in one statement,
I'm currently accomplishing it with 2 or more depending on the
circumstance, but would like to get it down to one if possible.

Does that help at all?

Thanks for checking this out,

JT

Christian Meisinger <c.*********@livingliquid.com> wrote in message news:<op**************@news.inode.at>...
Hello all, I've been using sql and mysql in particular for several
years now, but I'm having some trouble coming up with a query that
will pull the data that I need from a mysql table without using
multiple queries. Here's what I'm attempting to do:

Table1

column1-a, column2-a, column3-b, column4-b, column5-c, column6-c

in this example, each the table is storing 2 values for one record,
and this had to be done in one table, at the time. I could
re-structure the database, but if there exists a query to fit my needs
I would rather do that.

I need to search the first column in each pair and if it has a
matching value to what I'm searching for pull the second column in the
pair so I can generater a report from that data. I hope this is
enough information for anyone who wishes to make a recommendation. Is
it possible to accomplish this on one query?


WHAT?? :) sorry i really don't understand what you want...
is there only one table?
with 6 columns?
what pair???

chris

Jul 19 '05 #6
JT
Yeah, I figured that would be confusing.

This is all in one table. In the example I wrote out, there are 6
columns in that table, each divided into corresponding data elements,
this has nothing to do with the database structure itself, just how
the data was organized by the person who created the table.

I need to be able to check through the first of each pair, like you
normally write:

select field_2 from table_name where field_1 = 'data';

where field_1 is the first column of each pair within one row of a
table and field_2 is the second.

My problem is that I don't know if SQL can do this in one statement,
I'm currently accomplishing it with 2 or more depending on the
circumstance, but would like to get it down to one if possible.

Does that help at all?

Thanks for checking this out,

JT

Christian Meisinger <c.*********@livingliquid.com> wrote in message news:<op**************@news.inode.at>...
Hello all, I've been using sql and mysql in particular for several
years now, but I'm having some trouble coming up with a query that
will pull the data that I need from a mysql table without using
multiple queries. Here's what I'm attempting to do:

Table1

column1-a, column2-a, column3-b, column4-b, column5-c, column6-c

in this example, each the table is storing 2 values for one record,
and this had to be done in one table, at the time. I could
re-structure the database, but if there exists a query to fit my needs
I would rather do that.

I need to search the first column in each pair and if it has a
matching value to what I'm searching for pull the second column in the
pair so I can generater a report from that data. I hope this is
enough information for anyone who wishes to make a recommendation. Is
it possible to accomplish this on one query?


WHAT?? :) sorry i really don't understand what you want...
is there only one table?
with 6 columns?
what pair???

chris

Jul 19 '05 #7

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

Similar topics

10
1863
by: Irlan agous | last post by:
$query = "update reactie,form set 'reactie.persemail' = 'form.email' where 'reactie.persid' = 'form.id' AND reactie.persemail='' "; How can i get this query to work? Irlan
20
10079
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
6
2411
by: paii | last post by:
I have a table that stores job milestone dates. The 2 milestones I am interested in are "Ship Date" TypeID 1 and "Revised Ship Date" TypeID 18. All jobs have TypeID 1 only some jobs have TypeID 18....
3
1430
by: Eagle | last post by:
Hi all, This one's drivin' me nuts. Any help would be appreciated. (Access 2000). I have 3 tables: tblTools: having the basic data of a tool and a field (txt) showing yes or no with regard to...
3
1944
by: cover | last post by:
I have a table with 50 fields that receive input depending on whether that input came in from a 'shaker' form or a 'conveyor' form. Input from the 'conveyor' form might populate 25 fields while...
3
1518
by: faceman28208 | last post by:
Over the past few years I have consulted on six large projects that all independently arrived at the same moronic design desision: The use of SQL query classes. No, I don't mean a class...
0
2426
by: Chuck36963 | last post by:
Hi all, I've been working on a listing problem and I can't figure out how to work it out. I have looked far and wide on the web to find answers, but I'd like other peoples input on my project in...
8
8030
by: Roland Hall | last post by:
In Access you use "*" + + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access: ...
2
1952
by: sara | last post by:
I am helping a non-profit track their elder clients and care given to the clients. The organization would like a report that shows various info on ALL clients, such as: # in each town, # and...
20
5183
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to...
0
6904
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...
0
7076
jinu1996
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...
1
6730
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...
0
6873
tracyyun
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...
0
5321
agi2029
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,...
1
4767
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...
0
2990
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...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
174
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...

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.