Tuesday 15 April 2014

sql server 2008 - How to improve this query -


I have found this query that I use in one of my PHP applications:

  Select DictSchemeName.schemeName, DictSchemeName, DictTableName from DictTableName, DictSchemeName.Id = (Select Scheme Name from where the player is SID = 3 and service id = (Select id from service where applicationId = 'prga')) and DictTableName.Id = (SELECT TableName service from where the SID = 3 and service ID = (Select ID where service id = 'Prahaa')); As you can see, I repeat the same query for almost 2 times (DictSchemeName and DictTableName), I just start learning SQL and I would be happy if someone helped me. Can do.  

I am using MS SQL Server 2008

You included in the tables Should be able to:

  Select from ds.schemeName, dt.tableName (Selective SchemaName, Sublicensee with the table name, where sId = 3 and ServiceId = (Select ID from service where applicationId = ' Prga ')) included on the DictScheme name DS s.schemeName = ds.id internally included DictTableName dt s.tableName = dt.id;   

or beyond:

  Select ds.scheme name, dt.tableName service service from ss internal entry at ss.serviceId = s.id in service To join join Ss.tableName = dt.id on dictSchemeName DS ss.schemeName = ds.id joining DictTableName DT where ss.sId = 3 and s.applicationId = 'prga';    

No comments:

Post a Comment