473,611 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
+ 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 1382
> 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.*********@li vingliquid.com> wrote in message news:<op******* *******@news.in ode.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.*********@li vingliquid.com> wrote in message news:<op******* *******@news.in ode.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.*********@li vingliquid.com> wrote in message news:<op******* *******@news.in ode.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
1884
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
10127
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
2422
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. I need a query that will return the c date for TypeID 18 if it exist else the date for TypeID 1, for all jobs. the table structure is the following Job TypeID
3
1440
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 being in-stock. Unique toolNr is the primary key. tblOut: stores info on emloyee_ID and date of any occasion that the tool is being handed over to someone. (tblTools stock will be set to No). Primary
3
1958
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 input from the 'shaker' form will populate another 20-25 fields but not the same fields (however there are about 10 common fields to both). I'd thought about using two tables (one for 'conveyor' and the other for 'shaker') but thought I'd try just...
3
1525
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 hierararchy like: SQL Query UpdateQuery SelectQuery Where you hide the details of the underlying database API. (Along the lines of what Rogue Wave does.)
0
2439
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 the whole. I really need MySQL wizz to give me a hand (and maybe refer me to books to get me to the wizz level myself). First off, english is a second language to me and sometimes my sentences might be a little awkward. Please forgive me. Mon...
8
8040
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: WHERE LIKE '" & ASPvar & "' % ORDER BY ... However, my call is similar to: conn.qMyLookup strVar, rs
2
1964
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 Percent Male, Female, Smoker, # in age range # that use wheelchair or walker.
20
5210
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 write the parameter, I want to select a row from the listbox and after clicking in a button, the query to automatically take the current value of listbox as the needed parameter and then to load the query. (The Inputbox for "Enter Parameter" will...
0
8097
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,...
1
8240
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,...
0
8411
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7038
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6072
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
4108
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2546
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
1
1692
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1411
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.