I'm making this request but I get an error that
OVER is not suported by sql
SELECT FIRST_VALUE( JrnlStock.StockInitial) over (ORDER BY JrnlStock.date ASC),JrnlStock.Reference
where JrnlStock.Date > #Du
Maybe syntax is not right. Where is the FROM clause ?
https://msdn.microsoft.com/en-us/library/hh213018.aspx
Related
I have previously used ntile function in MS SQL in a project in R, but I need to change the database of the project in Mysql now. As per my knowledge Ntile is a window function in Sql Server,which is not present in Mysql. I have googled about this found the below link about ntile function documentation in Mysql.
Mysql Ntile Documentation
I have tried the same way as described but still facing the error.
My query:
SELECT *, NTILE(10) OVER w AS 'ntile10'
FROM test_table_name w AS (ORDER BY res_rate);
Any idea about the problem?
Is there any solution to overcome it?
You are missing WINDOW keyword:
SELECT *, NTILE(10) OVER w AS ntile1
FROM test_table_name
WINDOW w AS (ORDER BY res_rate);
or:
SELCT *, NTILE(10) OVER(ORDER BY res_rate) AS ntile1
FROM test_table_name;
Its very weird situation I know, nut I have got myself into it somehow. I have to connect to some other system service by passing some parameters in url.
In their service they are creating some query using parameter I pass.
For my case I have to pass 'Select' as a parameter name which is actually some class name on their side. So they end up in creating query as Select * from select
and some condition.
On execution I am getting error response as:
'There was a syntax error in a SQL query or filter expression at line
1, position 186. Saw \"Select\" but expected
'..SQL: \"SELECT col1, col2 FROM Select AS D where
some condition.
Can somebody help me on this.
Since Select is reserved word, you have to escape it by enclosing in backticks characters in order for MySQL to process your query:
select * from `select`
Its recommended not to use MySQL reserved keywords.. but if its necessary there is a solution..
Use this, it will work for you :
select * from yourdatabasename.select
I use group by with a count function in LARAVEL 4.2. When I tried to use LIKE in the same query, it gave me the error Invalid use of group function, as we can't use like with group by. How can I solve this?
You can't use Mysql aggregate function with group & like both together you have to use having instead of like.
Check here MySQL :: MySQL 5.0 Reference Manual :: 12.16.3 MySQL Handling of GROUP BY
and here: A similar SO question answer
Can anyone help my find this syntax error?
SELECT `song`, COUNT(*)
FROM `2015_awards`
WHERE `song` IS NOT `NoVote`
GROUP BY `song`;
I'm trying to exclude NoVote songs, and it won't work. Everything else is fine. When I Google problems like this, it looks as though it should work.
IS NOT is wrong. What you probably need to use is <>.
You cant not use pass NoVote as a value to IS or IS NOT
Try this:
SELECT song, COUNT(*) FROM 2015_awards WHERE song != 'NoVote' GROUP BY song;
The IS Keyword is only for NULL comparisons.
As Pigasus says, you probably should be using <>.
Hope this will solve your problem
select tf.Id,tf.Name,tf.LName,tf.Rank,tf.Category
where tf.Id not in (select fighter_id from tbl_player_fighter where league_id=91)
and tf.Status ='1'
This is throwing a syntax error. Any advice on how to fix this. Thanks.
You are missing a FROM clause, so it doesn't know the main table to use.