Thanks!!
I must have a problem with my code then !! I will check it out then.
Peter Brawley a écrit :
DROP TABLE IF EXISTS messages;
CREATE TABLE messages( message text, reference char(10), sender char(10));
INSERT INTO MESSAGES VALUES
('message1 text' , '05' , 'M01'),
('messag
DROP TABLE IF EXISTS messages;
CREATE TABLE messages( message text, reference char(10), sender char(10));
INSERT INTO MESSAGES VALUES
('message1 text' , '05' , 'M01'),
('message2 text' , '10' , 'M15'),
('message3 text' , '05' , 'M04'),
('message4
Hi
My guess is I have not described my problem well enough then ...
Here is an example of table one :
MESSAGE | REFERENCE | SENDER
message1 text | 05 | M01
message2 text | 10
Richard,
This is elementary---you most definitely do not need to do it with PHP
code. Given tables messages(senderid, message, reference) and
senders(senderid, name, address), this query
SELECT m.message, m.reference, s.name
FROM messages m
JOIN senders s ON m.senderid=s.senderid
WHERE m.ref
I've tried it and it does not work,
the problem is that there needs to be 1 table1 row for each table2 row,
and table 1 is the message list and the table two is the members
information list.
So I need the same row to be joined to all the message rows with the
same senderid ...
I guess I w
That query will give one row per table1 row matching your WHERE clause,
with matched row from table2. Is that what you want?
PB
Richard wrote:
Thanks,
I think I have found the correct syntax in a book I've got :
SELECT A.message,B.name
FROM table1 A
JOIN table2 B ON A.senderid=B.senderid
WHER
Richard
>I have table1 containing : message, senderid, reference
>and table2 contains: senderid, name, address
>I want to do a query that gives me : message, reference and name ...
Do you mean ...
SELECT t1.message, t1.reference, t2.name
FROM tbl1 t1
JOIN tbl2 ON t1.senderid=t2.senderid;
PB
-
You gave the answer. Using left join it will work and give you NULL values
for not found records.
I had a similar problem here and left join worked ok.
Bye,
Anderson Ataides
=
Em Quarta 24 Julho 2002 03:51, you wrote:
> Hi
>
> I'm de
Use:
tabProds LEFT JOIN tabUsers ON tabProds.usr_ID = tabUsers.usr_ID
from the manual:
If there is no matching record for the right table in the |ON| or
|USING| part in a |LEFT JOIN|, a row with all columns set to |NULL| is
used for the right table.
Jorge Garza wrote:
>Hi
>
>I'm designing 2