•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 428,634 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,987 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 403 | Replies: 3
![]() |
•
•
Join Date: Jun 2007
Posts: 16
Reputation:
Rep Power: 2
Solved Threads: 1
Hello-
I have these two tables:
...and I'm trying to figure out how to run this query: For each ampref.code, if its amp.name = 'LUNA' find its url. I would appreciate any help on this thanks.
I have these two tables:
CREATE TABLE ampref (
ampref_id serial NOT NULL,
amp_id integer NOT NULL,
code character varying(255) NOT NULL,
description text
);
CREATE TABLE amp (
amp_id serial NOT NULL,
name character varying(255) NOT NULL,
description character varying(255),
url character varying(255)
); Last edited by peter_budo : Feb 5th, 2008 at 4:59 pm. Reason: Please use [code] tags
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,471
Reputation:
Rep Power: 11
Solved Threads: 296
Something like this
SELECT url FROM amp WHERE name='LUNA';
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
•
•
Join Date: Oct 2005
Location: Manchester, UK
Posts: 482
Reputation:
Rep Power: 3
Solved Threads: 33
sql Syntax (Toggle Plain Text)
SELECT ar.url FROM amp a JOIN ampref ar ON a.amp_id = ar.amp_id WHERE a.name LIKE 'luna'
Note to self... pocket cup
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Query Help (MySQL)
- nested joins, from mdb. Possible? (Visual Basic 4 / 5 / 6)
- Query with Joins (Database Design)
- Problem with Rewriting Subqueries as Joins (Database Design)
- Query conversion from Sybase to MS SQL Server 2000 (MS SQL)
- Problem with Rewriting Subqueries as Joins (MS SQL)
- Troubled with Rewriting Subquery as JOINs (MySQL)
Other Threads in the MySQL Forum
- Previous Thread: Data Base error
- Next Thread: php/mysql dynamic multi-level menu problem



Linear Mode