473,395 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Query to pull current status only.

I have an equipment database that contains three tables: name, equipment and equipmentacitivity. The equipments are assigned and unassigned as used and return. Thus, each equipment, unless it is new, has been assigned (A) and unassigned (U). However, I need the query to pull ONLY the current status of all the equipment.
Jul 21 '10 #1
3 1565
TheServant
1,168 Expert 1GB
You will need to elaborate a bit more on your DB structure. You say you have three tables, but which one has the column current_status or whatever? Where/What do you assign (A) or (U) to?
The statement should be very simple:
Expand|Select|Wrap|Line Numbers
  1. SELECT current_status FROM equipment
Jul 22 '10 #2
Hello TheServant - the assigned codes, A and U, are stored in the equipmentactivity table under the CODE column. The assigned code change from A to U everytime the equipment is assigned and unassigned. Each equipment has been assigned and unassigned several times so some has mutiple A and U. However, I only need the current client the equipment is Assigned to not the previous ones. I ran the query below but it is leaving some record out.

SELECT distinct c.name, a.code, x.SerialNumber, a.date
FROM client C, equipmentactivity a, equipment x
where C.ID = a.ID and x.EquipmentID = a. EquipmentID
Group by a.code,x.SerialNumber;
Jul 22 '10 #3
TheServant
1,168 Expert 1GB
What is that returning, and what do you want it to return? You originally asked for a query to "pull ONLY the current status of all the equipment", but you seem to want a few other things, like names which are obviously stored in another table?

With regards to getting the current status (assigned, unassigned or never assigned), I would do that once you have the result instead of trying to do that with MySQL. If you're using PHP for example, it's quite easy to get the last character of a string, which sounds like it will be your current status.
Jul 23 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Apollo | last post by:
1.2Ghz Pentium, with 1/2Gig of ram, 4.0.14MySQL, RedHat9.0 I have about 20K records that result from the following query. Front end for the database is ACCESS97 and pulling up 20K records makes a...
1
by: Tim Graichen | last post by:
I currently populate a form based on a query. 1)How do I create a report that displays only the current record's fields and not all records in the table? Thanks Tim G
1
by: PMB | last post by:
Thank you in advance for any and all assistance. I'm trying to use a make table query to pull the last transactionID, so I can use an append query to reset the transactionID to the next...
2
by: OSMeier | last post by:
Hi Everyone, I am hoping you can help me. I am using MS Access 2000 for this. Here is the scenario: I have two tables: tblMain -------- ID (Primary Key)
2
by: seash | last post by:
hi I wrote a class like this.......in my application. public class cls { public static extern bool myApp ( ref string aa,
8
by: Richard D. Ford | last post by:
Does anyone know if VB has an exposed API that can be used to query DHCP for current address leases? I have seen threads that discuss DHCPObj.dll and have successfully used it. However, this only...
14
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity....
7
by: Marek Zawadzki | last post by:
Hi all, In your opinion: what is current status of frameworks for PHP and which one would you choose? I am looking for an all-purpose, MVC-based framework I could learn and use for all the...
5
by: RandyG | last post by:
how do you pull the current months data without having to manually input the date each time?
2
by: Bobby | last post by:
I am using access 2003. I have a form which is based on a simple query. Previously I could edit the data on the form, but now it is read only. The form has not changed and neither has the query....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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
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,...
0
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
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...

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.