I am trying to use the same value from a SELECT statement multiple times.
The beginning of my query looks like this:
IF EXISTS (SELECT * FROM `friends` WHERE (`Friend1ID`=value OR `Friend2ID`=value))...
value should be the result of a SELECT query, say:
SELECT `ID` FROM `users` WHERE `name`='daniel'
I could use the same SELECT statement twice, but are there any other possibilities that would make the query "cleaner"?