Hi there...
I want to query two tables in my db. One containing a list of numbers
ranging from 1 - 10200, the other table is storing information that is
relative to some of the numbers:
Eks:
Table1.record1: number=1
Table2.record1: number=1 name=John
Now I want to query these to tables to show a table that has one column with
the numbers, and if there is a name stored in the other table for this
number, I want to display this.
(
So.
I have been doodling with an "if" thingy in MySQL, but I am having trouble
getting result I need.
select
table1.number,
IF(table1.number = table2.number AND table2.name = NULL,
'No name registered',
table2.name)
FROM table1,
table2
LIMIT 0,30
What am I doing wrong here... It only displays the first name stored in the
table...?
- Trond -
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]