Skip Evans wrote:
Hey all,
I have a SQL requirement I'm not quite sure how to compose.
I have two tables, shows, and shows_dates. It's a one to many
relationship where there is a single entry in shows and multiple entries
in shows_dates that list each date and time for a play production
You'll need to do a left/right outer join.
as you didn't say which database you're using, I'll give this back to you to
do some reading up on how to do it...
HTH
Martin
-Original Message-
From: Marc Greenstock [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 11 February 2004 1:53 PM
To:
The problem is you are using a hard join which will only return rows where
there are matching entries in both tables. What you probably want is called
a left join, however you have a further complication.
You have to have an image row to have a image_data.Default_Img = 'Yes'. So
this query is
The DB is MySQL 4.0.16,
all tables are MyISAM
Martin Towell [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
You'll need to do a left/right outer join.
as you didn't say which database you're using, I'll give this back to you
to
do some reading up on how to do it...
HTH
Martin
Correct me if I'm wrong...PLEASE.. but, I believe you are looking for...
SELECT * FROM user_data left join image_data on
user_data.User_ID=image_data.User_ID where image_data.Default_Img = 'Yes'
GROUP BY user_data.User_ID
I haven't used enum('Yes','No') so I'm taking your word for the fact that
That works well,
Thanks all.
Warren Vail [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
The problem is you are using a hard join which will only return rows where
there are matching entries in both tables. What you probably want is
called
a left join, however you have a further
select * from tracker where day='1' and month=' .$month. ' XXX;
XXX = but donot return values with the same value in the sess_id field
what should XXX be ?
one line for each sess_id
select * from tracker where day='1' and month=' .$month. ' group by
sess_id;
or one line for
or one line for each sess_id with only one row:
select * from tracker where count(sess_id)=1 and day='1' and month='
.$month. ' group by sess_id;
sorry that was wrong!
correct:
select * from tracker where day='1' and month=' .$month. ' group by
sess_id having count(sess_id)=1;
michi
--
8 matches
Mail list logo