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

Home Posts Topics Members FAQ

help with JOIN

Hi Group,

I have three tables for a mailing list app I am trying to right... I want to try and avoid running 3 selects inside eachother..

The LIST table is a list of people what have registered for news letters, the newsletters table is a list of newsletter available, and the news list joins them up. I am trying to display the newsletters.new sletter_name for every list.id line.. So I would like to be able to say list.first_name , list.last_name has subscribed to newsletters.new sletter_name. I am not really sure this is possible as I would like to loop through the list RS as well as the newsletter RS set...

Anyway any ideas ???

describe list;
+------------+-----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------------------+------+-----+---------+----------------+
| id | mediumint(8) unsigned | | PRI | NULL | auto_increment |
| name_last | varchar(20) | YES | | NULL | |
| name_first | varchar(20) | YES | | NULL | |
| email | varchar(50) | YES | | NULL | |
| password | varchar(20) | YES | | NULL | |
| url_dir | varchar(10) | YES | | NULL | |
| format | varchar(4) | YES | | NULL | |
| date_in | timestamp(6) | YES | | NULL | |
+------------+-----------------------+------+-----+---------+----------------+
8 rows in set (0.09 sec)

mysql> describe newslist;
+------------+-----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------------------+------+-----+---------+----------------+
| id | mediumint(8) unsigned | | PRI | NULL | auto_increment |
| member | mediumint(9) | YES | | NULL | |
| newsletter | mediumint(9) | YES | | NULL | |
+------------+-----------------------+------+-----+---------+----------------+
3 rows in set (0.02 sec)

mysql> describe newsletters;
+-----------------+-----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+-----------------------+------+-----+---------+----------------+
| id | mediumint(8) unsigned | | PRI | NULL | auto_increment |
| newsletter_name | varchar(50) | YES | | NULL | |
| island_id | tinyint(4) | YES | | NULL | |
| resort_id | smallint(6) | YES | | NULL | |
+-----------------+-----------------------+------+-----+---------+----------------+
Jul 19 '05 #1
0 1595

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

Similar topics

9
3140
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use SUBSTRING(ProductName, 1, CHARINDEX('(', ProductName)-2). I can get this result, but I had to use several views (totally inefficient). I think this can be done in one efficient/fast query, but I can't think of one. In the case that one query is not...
3
2223
by: ColdCanuck | last post by:
Help! I'm trying to understand the new ANSI join syntax (after many years of coding using the old style). I am now working with an application that only understands ANSI syntax so I am struggling. My first (old style syntax) SQL statement below produces 60 rows: SELECT A1.CONTACTID, A1.LASTNAME, A1.FIRSTNAME, A1.ACCOUNT, A6.CITY, A6.STATE, A1.WORKPHONE, A1.FAX, A1.EMAIL
28
3308
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical make-believe challenge in order to avoid confusing the issue further. Suppose I was hosting a dinner and I wanted to invite exactly 12 guests from my neighborhood. I'm really picky about that... I have 12 chairs besides my own, and I want them all...
4
2868
by: jimh | last post by:
I'm not a SQL expert. I want to be able to write a stored procedure that will return 'people who bought this product also bought this...'. I have a user table that links to a transaction table that links to a transaction items table that links to the products table: (User Table) UserID Other user data
9
4361
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my predecessor, I hasten to add) so that each day it creates a copy of the record for each company, changes the date to today's date, and prompts the user for any changes of ratings on that day. The resulting data table grows by approx 600 records per...
5
1704
by: Arvin Portlock | last post by:
I can't come up with a query that works. Can anyone help? Conceptually the relationships are easy to describe. I have a table for books (Entries), a table for authors (Authors), and a linking table between the two because books often have more than one author (OA_Link). This situation is simple and common. A query to list each title and all the authors associated with that title looks like this: SELECT Entries.TitleStatement,...
3
2470
by: Mike Fellows | last post by:
Help, im trying to use a union join from an SQL database and a Access database - the program works fine from my own machine as i have the odbc DSN connections setup from access to link to the SQL tables. i need to set this up in code to connect to both databases and do my union join but i have no idea how to
1
3726
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am attach this script files and inq files. I cant understand this error. Please suggest me. You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am online. Plz....Plz..Plz...
3
1295
by: theintrepidfox | last post by:
Dear Group I'd be grateful if you can provide me with a hint for the following: Fields Table Contact ContactID Firstname Lastname Fields Table ContactMethod
0
3121
by: davidsavill | last post by:
Hi All, I am migrating a database from Firebird/Interbase to DB2 and have having issues with the stored procedures/functions. I have a number of functions that loop over a FOR loop, each pass it performs some logic on the row and inserts the output data into a temp table. The only point of the insert is so that I can select the data in a RETURN statement at the end of the UDF. In Firebird we could put these results directly into...
0
10568
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...
1
10311
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,...
1
7613
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
6847
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
5516
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
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4292
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
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2988
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.