1 Replies - 1037 Views - Last Post: 25 April 2012 - 11:10 AM Rate Topic: -----

#1 NewToJava2011  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 166
  • Joined: 21-November 11

MySQL multiple select ambiguous results

Posted 25 April 2012 - 02:40 AM

Using phpMyAdmin 5.1.44 to experiment with DML commands.

I've been following tutorials online.

SELECT book.b_isbn, publisher.p_name FROM 'book', 'publisher' WHERE book.b_title='DSA'


Table 1

book

b_id(PK)    b_isbn     b_title   p_id(FK)
-----------------------------------------
1           12345      DSA       1
2           23456      SD        1
3           34567      CSP       2



Table 2
publisher

p_id(PK)    p_name
--------------------
1           Fred
2           John




Expected Results
b_isbn      p_name
---------------------
12345       Fred




Actual Results
b_isbn      p_name
----------------------
12345       Fred
34567       John


Any ideas?

Is This A Good Question/Topic? 0
  • +

Replies To: MySQL multiple select ambiguous results

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9259
  • View blog
  • Posts: 34,739
  • Joined: 12-June 08

Re: MySQL multiple select ambiguous results

Posted 25 April 2012 - 11:10 AM

Are you trying to do a join? Something like this?

	SELECT book.b_isbn, publisher.p_name FROM 'book' join 'publisher' on book.p_id = publisher.p_id WHERE book.b_title='DSA'

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1