Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 months ago.
Improve this question
I have question about sql query
I use
select * from where
I like to know how to create a SQLitle query with the teams who win and possible_win %.
table is simple.
Team1,Team2,Team1_gols,Team2_gols,Team1_possible,Team2_possible
Table data is:
enter image description here
answer be only
team who win and possible win less 50
Try following query:
SELECT * FROM TABLE_NAME where
(V_G > H_G and Possible_win_V <50) -- V_G Won & Possibility of winning < 50
OR
(H_G > V_G and Possible_win_H <50); -- H_G Won & Possibility of winning < 50
I think this is what you're looking for:
SELECT *
FROM Table1
WHERE (Team1_gols > Team2_gols AND Team1_possible < 50) -- team 1 wins with < 50 probability
OR
(Team1_gols < Team2_gols AND Team2_possible < 50) -- team 2 wins with < 50 probability
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am trying to sum the frequency of the words cumulatively in PostgreSQL
Here's my table (example)
I need sum accumulative frequency for same words, for example the expected results is:
resize (100 + 85) = 185
trabajar (75 + 73) = 148
partir (64) = 64
How can I make the query?
you need to use GROUP BY :
SELECT
word
, SUM(frecuency)
FROM tablename
GROUP BY word
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Input:
A
-----
5000
4000
-3000
-2000
Output:
A FEEDBACK
----- --------
9000 POSITIVE
-5000 NEGATIVE
THEY HAVE GIVEN THE INPUT. I NEED TO WRITE A CODE TO BRING THE OUTPUT.
I think this query should do:
select sum(a) as a, 'POSITIVE' as feedback from t where a >= 0
union
select sum(a) as a, 'NEGATIVE' as feedback from t where a < 0
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Need a query to check ids with multiple revisionnums
id reviionnum
1 0
2 0
1 1
3 1
2 1
The query should result
id revisionnum
3 1
Please help
If you want ids with only one revision number, you can use aggregation:
select id, min(revissionnum)
from t
group by id
having count(*) = 1;
The min() is the value if there is only one row.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have a table which has the below data:
PLAYER RUN
-----------------
Kohli 100
Kohli 200
Sachin 200
Yuvi 300
Yuvi 300
Yuvi 300
I need to return the Player's name who scored the maximum number of runs.
How can I achieve this by a SQL query ? In this case the query should return "Yuvi" .
Could you please use the query given below
SELECT TOP 1 PLAYER, MAX(RUN) AS MAXRUN FROM <TABLE> GROUP BY PLAYER ORDER BY MAXRUN DESC;
select player from (select player , sum(runs) from test group by player,runs order by sum(sal) desc) where rownum=1;
You should use Max function in the column RUN. The query will be,
Select PLAYER, MAX(RUN) from TABLE;
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have got table like below after sorting in SQL:
M_ID
-----
2013/01
2013/02
2013/03
2013/04
2013/05
2013/06
Now I want to assign each entries a particular value like below
M_ID Days
--------------
2013/01 20
2013/02 30
2013/03 40
2013/04 50
2013/05 60
2013/06 70
So, can you please let me know how to do that in SQL Query?
Do you mean something like this (presuming sql-server)?
SELECT M_ID,
Days = (ROW_NUMBER()OVER(ORDER BY M_ID) + 1) * 10
FROM dbo.TableName
Demo