dbTalk Databases Forums  

subquery help

mailing.database.mysql mailing.database.mysql


Discuss subquery help in the mailing.database.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
leegold2
 
Posts: n/a

Default subquery help - 07-17-2004 , 12:54 PM






I tried what's below, seemed OK, so I replaced an "IN" for the "=" in
the subquery below because of the subquery's error message. I thought
w/"IN" I'd get three (3) records returned as expected. But when I tried
"IN" I got my entire DB returned - I don't show that below - it kept
scrolling so I aborted it. What did I do wrong? Seems like the inner
just returns three recs. and should match-up w/the outer for three recs.
too. I'm using 4.1. Thanks, any help arrpeciated. Lee G.


mysql> SELECT access_no FROM balloon_txt WHERE MATCH
(access_no,recs_txt) AGAINST ('robin');
+------------+
Quote:
access_no |
+------------+
BT-1037.11 |
BT-2540 |
BT-1034.06 |
+------------+
3 rows in set (0.01 sec)

mysql> SELECT * FROM balloon_rec WHERE access_no='BT-1034.06';
+------------+--------------------------------------------+----------------+------------+-------------------------------------------------------------------+
Quote:
access_no | title | author
doc_date | elec_access

+------------+--------------------------------------------+----------------+------------+-------------------------------------------------------------------+
BT-1034.06 | Status of Meteorological Sounding Balloons | Robert
Leviton | 1963-12-01 |
http://Databases/Balloon/Data/BT1034.06.pdf |
+------------+--------------------------------------------+----------------+------------+-------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT * FROM balloon_rec WHERE access_no=(SELECT access_no FROM
balloon_txt WHERE MATCH (access_no,recs_txt) AGAINST ('robin'));
ERROR 1242 (21000): Subquery returns more than 1 row


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.