469,271 Members | 1,713 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

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 1265
> 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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Irlan agous | last post: by
6 posts views Thread by paii | last post: by
3 posts views Thread by Eagle | last post: by
3 posts views Thread by cover | last post: by
3 posts views Thread by faceman28208 | last post: by
2 posts views Thread by sara | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.