keisx
03-15-2010, 08:12 AM
Hi! I need to create a query, however there are some difficulties and to be honest I don't know if it's even possible. So I have this simple query now:
SELECT Drivers.Driver_name, Drivers.Drivers_surname, Teams.Team_name + '-' + Teams.Team_engine AS Komanda
FROM Teams INNER JOIN Drivers ON Teams.Teams_id = Drivers.Teams_id
What I want to do is, in case there's a match between Teams.Team_name and Teams.Team_engine (which is possible), then select only one of them, otherwise select both, separating them by a dash, as given in my example. Is it possible?
SELECT Drivers.Driver_name, Drivers.Drivers_surname, Teams.Team_name + '-' + Teams.Team_engine AS Komanda
FROM Teams INNER JOIN Drivers ON Teams.Teams_id = Drivers.Teams_id
What I want to do is, in case there's a match between Teams.Team_name and Teams.Team_engine (which is possible), then select only one of them, otherwise select both, separating them by a dash, as given in my example. Is it possible?