Ok heres the deal I have one table that is like this called Licenses:
App License
-----------------
1 4585
2 4587
3 5214
and another like this called UserToLicenses
User License
------------------
no data
How can I do a query that basicly does this: I need to return a license for an app id that I specifiy but I want to return the license if the user matches the license or if it does not meaning if there is no data in the UsersToLicenes table then I just get back the license that matches the supplied appid but if a user is in the UserToLicenses table then I want to get that license which is also based on the appid.
here's a little more visual ....
Basically I want this if I got data ...
Select Licenses.License From Licenses, UserToLicenses
Where Licenses.AppID = 1
And UserToLicenses.UserID = 1
if no data out of that query then run this...
Select License From Licenses Where AppID = 1
Thanks ... this problem is killing me.
App License
-----------------
1 4585
2 4587
3 5214
and another like this called UserToLicenses
User License
------------------
no data
How can I do a query that basicly does this: I need to return a license for an app id that I specifiy but I want to return the license if the user matches the license or if it does not meaning if there is no data in the UsersToLicenes table then I just get back the license that matches the supplied appid but if a user is in the UserToLicenses table then I want to get that license which is also based on the appid.
here's a little more visual ....
Basically I want this if I got data ...
Select Licenses.License From Licenses, UserToLicenses
Where Licenses.AppID = 1
And UserToLicenses.UserID = 1
if no data out of that query then run this...
Select License From Licenses Where AppID = 1
Thanks ... this problem is killing me.