Atul_Vaidya wrote: > Hi, I have three tables, > 1. Table Entity_xdata containing following fields.... >> Entity_id|Layer|grpuid| > > 2. Table, group_xdata_pipe containing following fields .... >> grpuid|LNV| > > 3. Table group_id_vs_reggappname containing following fields .... >> grpuid|reggappname| > > Now, I need to Fire a query to SQlite where in I get the list of all > the distinct LNVs. Currently I achieve it by following two query > commands as follows .... > SELECT DISTINCT Entity_xData.grpuid from Entity_xdata INNER JOIN > group_id_vs_regappname ON(Entity_xdata.grpuid = > group_id_vs_regappname.grpuid AND group_id_vs_regappname.reg_appname = > 'CPD1') > I get the grpuids using this command and then i use the grpuids that > i get from this query, as an input to my next query, something like > this ... > > SELECT DISTINCT Line_Number_View FROM (SELECT grpuid,line_number_view > FROM group_xdata_pipe WHERE grpuid = '%s' ORDER BY grpuid ASC)ORDER BY > Line_Number_View ASC",query_result[x]) > > My question is > Is it possible to combine both these querries into one ?
SELECT DISTINCT Line_Number_View FROM group_xdata_pipe WHERE grpuid IN ( SELECT Entity_xData.grpuid FROM Entity_xdata INNER JOIN group_id_vs_regappname ON ( Entity_xdata.grpuid = group_id_vs_regappname.grpuid AND group_id_vs_regappname.reg_appname = 'CPD1') ) ORDER BY Line_Number_View ASC; Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users