for eg...
SELECT *
FROM ( SELECT RANK() OVER (ORDER BY stud_mark DESC) AS ranking,
stud_id,
stud_name,
stud_mark
FROM tbl_student ) AS foo
WHERE ranking = 10
Here foo is present...actually what it does ?..
...
I am tying an alternate to limit sub queries in mysql, since mysql 5 does not support limit keyword in subquery:
SET @i = 0;
SELECT BuildID, COUNT(TestCase)
from results R
where R.BuildID IN (select B.BuildID
from build B
where ( @i := ( @i +1 ) ) <= 25
and B....
We have a database table that stores the location of some wave files plus related meta data. There is a foreign key (employeeid) on the table that links to an employee table. However not all wav files relate to an employee, for these records employeeid is null. We are using LinqToSQl to access the database, the query to pull out all no...
Hi
Please advise on how to merge two results in to one using SQL Server 2005.
I have the situation where an Account can have up to two Settlement Instructions and this has been modeled like so:
The slim-ed down schema:
Account
---------------------
Id
AccountName
PrimarySettlementId (nullable)
AlternateSettlementId (nullable)
Settl...
i am doing conditional formatting on a report in access
i need to check if a certain string exists in a field as the condition in conditional formatting. something like this:
[field_name] like '%something%'
will this kind of condition work?
...
Actually i' am using MyTimeStampField-TRUNC(MyTimeStampField) to extract the time part from an timestamp column in Oracle.
SELECT CURRENT_TIMESTAMP-TRUNC(CURRENT_TIMESTAMP) FROM DUAL
this return
+00 13:12:07.100729
this work ok for me, to extract the time part from an timestamp field, but i' m wondering if exist a better way (m...
My application has one table called 'events' and each event has approx 30 standard fields, but also user defined fields that could be any name or type, in an 'eventdata' table. Users can define these event data tables, by specifying x number of fields (either text/double/datetime/boolean) and the names of these fields. This 'eventdata' (...
In what cases would a call to java.sql.ResultSetMetaData.isSearchable(int col) return false for an Oracle database? The documentation for the method doesn't really answer the question:
"Indicates whether the designated column can be used in a where clause."
I can think of only one case - when the column is the result of an aggregate...
While trying to optimize SQL scripts, I was recommended to add indexes.
What is the easiest way to specify what Database the index should be on?
IF EXISTS (SELECT * FROM sysindexes WHERE NAME = 'idx_TableA')
DROP INDEX TableA.idx_TableA
IF EXISTS (SELECT * FROM sysindexes WHERE NAME = 'idx_TableB')
DROP INDEX TableB.idx_Tabl...
How can MySQL insert multiple records by executing a single insert statement?
The problem at hand involves 1 to 10 records, depending upon user input.
...
Alright, first you'll need to grab a barf bag. I've been tasked with optimizing several old stored procedures in our database. This SP does the following:
1) cursor loops through a series of "buildings"
2) cursor loops through a week, Sunday-Saturday
3) has a huge set of IF blocks that are responsible for counting how many Objects of ...
Hi,
Can anyone please help me?
I am having bunch of .sql files. I want to parse (validate) those files before executing them on server.
I have many online sites which parse the code. But I want to parse the code using C#.
So please can you guide. If there is any tool, dll I need to use.
I just want to parse the file and not execute...
Hey, my app parses numerous txt files in a directory that are almost all formatted identically, then inserts the values into columns of my sql db. However, there are a few files that the app has come across where a value is 'blank' instead of '0.0', so the application fails stating that it cannot convert that value to numeric.
Is there ...
I am try to find the top n number of categories as they relate to articles, there is a habtm relationship set up between the two. This is the SQL I want to execute, but am unsure of how to do this with ActiveRecord, aside from using the find_by_sql method. is there any way of doing this with ActiveRecord methods:
SELECT "categories".id,...
When I first started working at the company that i work at now, I created a java application that would run batches of jasper-reports. In order to determine which parameters to use for each report in the set of reports, I run a sql query (on sqlserver). I wrote the application to take an xml file with a set of parameters for each report ...
Since @A is never declared, sql server should throw an error, but it doesn’t. Why is that?
DECLARE @i int = 1;
IF @i > 10
BEGIN
DECLARE @A int = 100;
END
PRINT @A; // doesn't return any result
thanx
...
I am going to be crazy I think. Please Help.
I have a table which fields are Date, No, Turnover, TotalWin, Opencredit, Handpay, Billin, gamesplayed and I am trying to write sql in vb.net that will show me previous day value but I cant. Here is what I am trying to do.
SELECT Meter.*
FROM
Meter AS Previous,
Turnover As Prev_turnov...
I'm doing a little datamining project where a perl script grabs info from a SQL database and parses it. The data consists of several timestamps. I want to find how many of a particular type of timestamp exist on any particular day.
Unfortunately, this is my first perl script, and the nature of perl when it comes to hashes and arrays is c...
I have am getting an error when I try and alter a date column:
Arithmetic overflow error for type varchar, value = 20100601.000000.
I would like it to go from float to the datetime format of 20100601.
Since Alter doesn't work, how can I use cast or convert to change the datatype for every entry in the table?
...
I need to count how many people belong in pre-defined groups (this is easy to do in SQL using the SELECT COUNT statement). My Views query runs fine and displays the actual data in my table, but I simply need to know how many results it found.
However there doesn't seem to be a COUNT option in views. I am guessing I am going to have to u...