| | |
New to joins - Need help with query...
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2007
Posts: 16
Reputation:
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:
MySQL Syntax (Toggle Plain Text)
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 5:59 pm. Reason: Please use [code] tags
Something like this
MySQL Syntax (Toggle Plain Text)
SELECT url FROM amp WHERE name='LUNA';
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
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
Sorry my bad, didn't see ampref.code there
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
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: Help with SQL Statement Please
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm data database design developer development distinct drupal dui ec2 email enter eudora facebook form foss gartner gnu government greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier journalism keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php priceupdating query referencedesign reorderingcolumns resultset saas select simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization






