Hey folks-
'nother question.
I'm not an SQL expert, and I think I need a subselect, which means I need a
workaround on MySQL 3.23 or whatever version it is.
Here's the tables I have, with the relevant columns:
Students
- Name
- StudentID (PK)
- ClassID
Classes
- ClassID (PK)
- Name
Each
-Original Message-
From: Lefevre, Steven [mailto:[EMAIL PROTECTED]]
Hey folks-
'nother question.
I'm not an SQL expert, and I think I need a subselect, which
means I need a workaround on MySQL 3.23 or whatever version it is.
Here's the tables I have, with the relevant columns:
R.StudentID='364326' AND R.ClassID=C.ClassID
--Joe
--
Joe Stump [EMAIL PROTECTED]
http://www.joestump.net
-Original Message-
From: Lefevre, Steven [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 8:22 AM
To: [EMAIL PROTECTED]
Subject: subselect workaround help?
Hey folks
From: Lefevre, Steven [EMAIL PROTECTED]
...I think I need a subselect...
It's rare that a sub-select is actually ~needed~, but it does happen. You can almost
always get around it with a JOIN of some sort.
Final result should look like
Student | Class
--
Steve
Student | Class
--
Steve Lefevre | Math101
Stacy Adams | Intro to SQL
Something like
SELECT Student.Name, Classes.Name FROM Students, Classes WHERE
Students.StudentID = . $ID . AND Classes.Name IN ( SELECT
Classes.Name
FROM Classes WHERE ClassID = Students.ClassID )
How would one load the results of the following query into a one line comma
separated list so that it could be then included with an IN expr to get
around the lack of subselect in MySQL
select distinct symbol from portfolio where type='401k' AND owner='jim'
select distinct p.symbol, i.name
Message-
From: Mr. psm996 [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 02 January, 2002 09:30
To: [EMAIL PROTECTED]
Subject: SubSelect Workaround help
How would one load the results of the following query into a one line comma
separated list so that it could be then included with an IN expr
Hi Paul,
There is no direct way to make a string by concatinating strings of
different columns. But your problem can be solved in a different way.
select distinct p.symbol, i.name from portfolio p, portfolio pp, stockinfo i
where pp.type = '401k' AND pp.owner = 'jim'
and p.symbol = i.symbol