In the following:
(running a query on the Stack Exchange Data Explorer, which uses an SQL Azure implementation of OData. The FAQ says it supports most of the TSQL commands):
DECLARE @MinPosts int = ##MinNumberOfPosts##
SELECT
Id AS [User Link],
Reputation,
(SELECT COUNT(*)
FROM posts
WHERE posts.OwnerUserId = Users.I...
Windows 7, Visual Studio 2010, tagert framework = .NET 4 Client Profile
I'm creating a desktop application, completely local, it doesn't access servers. For that i'm using a .MDF SQL Server database and LINQ. Everything works fine on my machine, however, when i deploy it, the following error is shown when i try to connect to the databa...
Hi,
Recently in an interview I was asked to write a query where I had to fetch nth highest salary from a table without using TOP and any sub-query ?
I got totally confused as the only way I knew to implement it uses both TOP and sub-query.
Kindly provide its solution.
Thanks in advance.
...
Hi, I want to do some updates, which logically looks like below -
UPDATE t1
SET (x1, x2) = (SELECT x1, x2
FROM t1
WHERE id_1 = 8
AND id_2 =1
AND id_3 = 3)
;
But from the documentation it looks like...
Hey all,
I have the Following Table:
StockID,FundID,DateID,ValueInDate
I want to Create a GROUP BY Query that show's the Precentage Of every Fund From The Total
Value in the specific Date, Without Parameters.
I have the @DateID Parameter only in this Query
any ideas?
Thanks!
...
I'm using C# , .NET and SQL Server with Linq2SQL.
What does this error mean?
Is it a insert or read/select related error?
The function Classes.BLL.Save(LPage l) first selects COUNT from database and then INSERT a new record to database.
2010-09-03 04:57:56,264 System.Data.SqlClient.SqlException (0x80131904): Timeout expired. The tim...
I have this SQL query which due to my own lack of knowledge and problem with mysql handling nested queries, is really slow to process. The query is...
SELECT DISTINCT PrintJobs.UserName
FROM PrintJobs
LEFT JOIN Printers
ON PrintJobs.PrinterName = Printers.PrinterName
WHERE Printers.PrinterGroup
IN (
...
Well, it can, but I can't query ;)
Here's my query:
SELECT code.id AS codeid, code.title AS codetitle, code.summary AS codesummary, code.author AS codeauthor, code.date, code.challengeid, ratingItems.*, FORMAT((ratingItems.totalPoints / ratingItems.totalVotes), 1) AS rating, code_tags.*, tags.*, users.firstname AS authorname, users.id ...
Can somebody explain difference between "before" and "after" trigger in oracle 10g with an example ?
...
Oki so I have two tables: person and person_email
PERSON
------
id (PK)
person_code (Unique key 1)
person_type (Unique key 1)
surname
forename
PERSON_EMAIL
------------
id (PK)
person_id (Unique key 1) (references person(id))
email_address (Unique key 1)
Is this correct??
or should it be:
PERSON_EMAIL
------------
id (PK)
person_i...
I'm having a bit of a problem deciding how to store some data. To see it from a simple perspective, it will be a simple table of data but there will be many tables. There will be about 7 columns in each table, but again there will be a lot of tables (and they will be created at runtime, whenever the customer wants a clean grid)
The data...
I was reading a book and it talks about a User has some more UserDetail, and so the UserDetail will have a user_id pointing back to the Users table. I kind of forgot that, does it help at all to has a field in Users table to have a user_detail_id to point at the UserDetail record?
This is so in Ruby on Rails too, that the Users table d...
I have a database which stores temperature-logging data from various instruments. Data may be logged as often as once per minute. One approach to designing a log table would be to put each log entry in its own row along with the device ID, a time stamp, and a sequence number (even if the clock on a device is changed, it should be possi...
Hi,
I'm trying to connect to my db in Oracle with the following code:
#include "mainwindow.h"
#include <QCoreApplication>
#include <QtGui>
#include <QtSql>
int main(int argc, char **argv)
{
QCoreApplication myApp(argc, argv);
QSqlDatabase db;
db.addDatabase("QOCI");
db.setDatabaseName("RFV75");
db.setUserName("RFV...
What I am trying to achieve is to get the rows having the maximum value from a table of the following form:
A | B | Ratio
0 | 1 | 1.0
1 | 2 | 1.0
2 | 3 | 1.0
3 | 4 | 0.33
4 | 5 | 0.25
I am trying to display only rows containing the maximum value (in this case 1.0). May be I am not doing this right. I have a query of the form:
SELECT...
Welcome,
I'm wondering is it possible to reverse returned data in sorting "order by desc" but i want that data in reverse order.
For example, i got table with values
ID
1
2
3
4
And i do
Order by ID ASC LIMIT 3
I got
1
2
3
When i do Order by ID DESC limit 3
i get
4
3
2
I would like to have
3
2
1
So i would like to order by...
Is there a way that one can cause CakePHP to dump its SQL log on demand? I'd like to execute code up until a point in my controller and see what SQL has been run.
...
I have a query that based on various ids within a table should return different results.. So for example:
Table 'orders'
product_id
item_id
extra_id
something_id
I'd like return a result based on the values of these, such as
IF item_id != 0 'ITEM' ELESEIF product_id != 0 'PRODUCT', etc.
Does anyone know how to do this?
Thanks!
...
The below code doesn't work. The while loop doesn't display any values. If I change it to 0 and 150 it works fine. Please help me out here. Anything other than 0 doesn't retrieve any value. Using Oracle database. I tried using ORDER BY but it still doesn't work.
ResultSet rset1 = stmt.executeQuery
(" SELECT * FROM (SELECT * FROM iri...
My database schema looks like this:
Table t1:
id
valA
valB
Table t2:
id
valA
valB
What I want to do, is, for a given set of rows in one of these tables, find rows in both tables that have the same valA or valB (comparing valA with valA and valB with valB, not valA with valB). Then, I want to look for rows with...