[Solved] Query to find man of the tournament [closed]
select player from (select player , sum(runs) from test group by player,runs order by sum(sal) desc) where rownum=1; 1 solved Query to find man of the tournament [closed]
select player from (select player , sum(runs) from test group by player,runs order by sum(sal) desc) where rownum=1; 1 solved Query to find man of the tournament [closed]
Since you want to get 80 rows for both text and NO text, you can use UNION ALL. You can also order your data as per your requirement: (SELECT first_column, last_column FROM MyTable WHERE last_column = ‘text’ ORDER BY first_column LIMIT 80) UNION ALL (SELECT first_column, last_column FROM MyTable WHERE last_column = ‘NO text’ ORDER … Read more
Or you could use BETWEEN aside from TOP statement like: SELECT TOP(10) * FROM table1 WHERE cat = 1 and datee BETWEEN DATEADD(day, -1, @dt) AND @dt ORDER BY datee DESC solved Get entries stored in database from yesterday [duplicate]
SELECT DISTINCT AccountKey FROM TABLE WHERE (ProductGroup = ‘A’ AND ProductVersion = 13) OR (ProductGroup != ‘A’ AND ProductVersion = 19) 1 solved SQL: write nested query in SQL [closed]
Don’t put tags in columns. Instead create a separate table, named something like movie_tags with two columns, movie_id and tag. Put each tag in a separate row of that table. This is known as “normalizing” your data. Here’s a nice walkthrough with an example very similar to yours. Edit: Let’s say you have a catalog … Read more
Either use single quotes, like q = “select tbuc.csId, tbuc.uId, tbuc.cId, tbui.role_type, tbuc.time as login_date” + “, tbuc.sessId, (case when tbui.role_type=”ROLE_USER” then 1 else 0 end) ” + “as assignment_submitted FROM tb_user_click tbuc, tb_user_info tbui WHERE ” + “tbui.user_id = tbuc.uId and tbuc.csId = tbui.class_section_id;” Or escape the double quotes, like q = “select tbuc.csId, … Read more
If I understand you correctly, you are looking for all the store procedure names that have the nolock keyword: SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION LIKE ‘%nolock%’ AND ROUTINE_TYPE=’PROCEDURE’ 9 solved How to find list of tables used in stored procedure without “With (nolock)” words [closed]
You can use concat as SELECT Source, QtyPrevious, QtyToday, ProductPrevious, ProductToday, AvaDatePr, AvaDateToday, Clusters, CONCAT(X, ”, Y) as Z from your_table_name; solved How to concatenate two different values from two different columns with comma ” , ” using TSQL?
The stack trace points to a NotFound in OperationType Read, ResourceType Collection. This means that the Uri that you are passing, is not pointing to a collection that exists in that account. You are creating the Uri using: UriFactory.CreateDocumentCollectionUri(_azureCosmosDbOptions.Value.DatabaseId, “catlogdb”) Check the value of _azureCosmosDbOptions.Value.DatabaseId and verify it is valid and it’s the one you … Read more
You can use FLOOR function to do this. It will round up your numbers, so you can pick only this that are not integers. create table #t (i decimal(12,6)) insert into #t values (1), (1.1) select * from #t where FLOOR(i) <> i solved Show data where the value is after the decimal point
Yes it is, like “Tom asked a question:__ in:__ few minutes a go” So you need a user name, an action, a timestamp and a hidden id. Well performance-wise a separate table is better (you avoid unions and maybe joins if it’s not necessary to be mormalized), but you have the extra storage (is this … Read more
Like here, here or here. SELECT [TicketId], STUFF(( SELECT ‘, ‘ + [Name]) FROM [OneTable] WHERE ([TicketId] = OT.[TicketId]) FOR XML PATH(”),TYPE).value(‘(./text())[1]’,’VARCHAR(MAX)’) ,1,2,”) AS Name FROM [OneTable] OT GROUP BY [TicketId] Go and vote it up, then close this question. 1 solved Getting Data separated by comma, [duplicate]
The query below uses a Join which should be faster than a subquery. Select t1.ContractId, t2.MissionId From tab t1 Join tab t2 ON t1.ContractId = t2.ContractId Group By t1.ContractId, t2.MissionId Having Count(*) > 1 2 solved Sql request selection
You can use the following query: SELECT cust_name FROM mytable GROUP BY cust_name HAVING COUNT(*) > 1 to get the cust_name values of duplicate records. Use this query as a derived table and join back to the original table to get the desired result: SELECT t1.* FROM mytable AS t1 JOIN ( SELECT cust_name FROM … Read more
You use JOIN but didn’t use on to connect two table, from your tables you might use actorID columns to be the connected condition. when you use an aggregate function you might use non-aggregate columns in group by SELECT a.lname,a.fname,AVG(c.salary) FROM Actor a JOIN Castings c on a.actorID = c.actorID group by a.lname,a.fname order by … Read more