November 22nd, 2000, 07:04 AM
I wondered how to check a selection ( select * from db where this and that) if two rows have the same values in tow columns.
In numbers: check if row(1) AND row(2) have the same value in col(x) AND in col(y).
Thanks in advance
November 22nd, 2000, 06:16 PM
You have to use the same table twice and give it a different alias, as below:
select a.*, b.*
from table1 as a, table2 as b
where b.column_x = a.column_y
hope that helps...
November 23rd, 2000, 10:24 AM
November 24th, 2000, 05:33 AM
How about comparing each item against a single record on your table?
November 24th, 2000, 05:58 AM
I don't quite get what you mean. I'll explain my situation a bit more.
I'm working on a timetable. Students visit the site, choose the lectures, hit a button and there we go, a neat timetable.
Now, as some lectures are at the same time I want those out of the result to "echo" them in, let's say red.
I'm using a php-class, which generates a table, using "x" and "y" coordinates for table row/cell. Found it somewhere an modified it slightly. The query I ran is this:
" $result1 = mysql_query("SELECT a.x, a.y, b.x, b.y FROM plan AS a, plan AS b WHERE a.x=b.x AND a.y=b.y"); "
So could you give me a query-example of what you meant?
Thanks for the help
[This message has been edited by Otis (edited November 24, 2000).]