473,763 Members | 3,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

subselects or join?

Hi List,

My head is not on right today.

I have something like this:

main_table

id name main_type
1 joe type1
2 john type2
3 jack type1
table type1

id_type1 id action
1 1 2003-07-01
2 1 2003-08-03
3 2 2003-04-04
4 1 2003-09-09

I want to do a query to find all the names with an action date between a
range of dates.

For instance:

The "logic" reads.

I want the names, dates of the action and main_types of all the people
who have an "action" entry in the type1 table between date1 and date2
(where date1 and date2 are user input for the search criteria).

The result MUST contain duplicate names (if like for example Joe in the
example above, has more than one "action" entry in the table that lies
in the search date range.)

Help?

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1077

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

Similar topics

0
1785
by: Jacob Friis Larsen | last post by:
Which is fastest? This: SELECT id, title FROM questions LEFT JOIN users USING (userid) WHERE zipcode = 2000; or this: SELECT id, title FROM questions WHERE userid IN (SELECT userid FROM users WHERE zipcode = 2000);
6
2427
by: Jeff Kowalczyk | last post by:
I need to adapt this an update statement to a general form that will iterate over multiple orderids for a given customerinvoiceid. My first concern is a form that will work for a given orderid, then an expanded version that will work on all orderids with a specific customerinvoiceid as a parameter. I'm sure appropriate joins will handle it, but I'm not making any headway, everything comes back with multiple tuple selected for update...
0
1008
by: Hegedus, Tamas . | last post by:
Dear All, I am a biologist and I do not know what to expect from an RDB (PgSQL). I have large tables: 1215607 rows in prots, 2184596 rows in kwx (see table details below). I would like to do something like that: SELECT name, seq FROM prots WHERE fid in (SELECT fid FROM kwx WHERE kw_acc=812); After executing this (either as a subquery or joins) the best/fastest result what I had (SET enable_seqscan=off): 83643.482 ms (see EXPLAIN...
0
980
by: Tarun Mistry | last post by:
Hi guys, I have posted this in 2 groups hoping to catch up on some difference knowledge. I am making an application in c# with a SQL 2000 back end. I am trying to use the new dataset available in VS 2005 to auto-magically provide my data access layer. Unfortunately, in order to take advantage of this automation, I cannot use JOINs in my queries, I must use subselects, however i'm worried about the performance hit subselects may have.
1
3142
by: nullGumby | last post by:
I'm trying to get a UNION of UserIDs from multiple subselects. The original query--which puts all the found UserIDs into separate columns, looks like this: -------------------------------------------------------------------------------- SELECT tmp_MY_TABLE_2_3_4.LAST_UPDATED_USER_ID AS UserID_1 MY_DB_1.MY_TABLE_5.LAST_UPDATED_USER_ID AS UserID_2 MY_DB_1.MY_TABLE_6.LAST_UPDATED_USER_ID AS UserID_3
0
9566
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
10149
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...
0
10003
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9828
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
8825
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
7370
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
6643
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
5271
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5410
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.