Structured Query Language (SQL) is a language for querying databases. Questions should include code examples and table structure. This tag refers to the standard language, not for questions about specific vendor extensions, like MySQL or Microsoft SQL Server, so if you think your question relates to ...

learn more… | top users | synonyms (5) | sql jobs

0
votes
0answers
9 views

How to get id, if there are ambiguous entries in table

Let's consider the following table. Id(PK, int) | DocDate(long) | Sender(varchar) | Recipient(varchar) | PeriodStart(long) | PeriodEnd(long) For every Sender, Recipient, PerdiodStart, PeriodEnd I'm ...
0
votes
0answers
6 views

Getting Count Only of Distinct Value Combinations of multiple fields.

Please consider the following: IF OBJECT_ID ('tempdb..#Customer') IS NOT NULL DROP TABLE #Customer; CREATE TABLE #Customer ( CustomerKey INT IDENTITY (1, 1) NOT NULL ,CustomerNum INT ...
0
votes
0answers
3 views

SQL duration between dates for different persons

hopefully someone can help me with the following task: I`ve got 2 tables 'Treatment' and 'Person'. Treatment contains the dates when treatments for the different persons were started, Person contains ...
0
votes
1answer
22 views

SQL Output Syntax

While I consider this to be a fairly simply query, apparently there is "Incorrect syntax near 'output'". Other online resources have not been helpful in debugging this problem. What am I doing wrong ...
0
votes
0answers
12 views

joining columns to collection table when one field is not null

I've this kind of a problem in Java. I've got 2 tables: @Entity(name = "Market") @Table(name = "mi_market") public class MarketModel { @ElementCollection(fetch = FetchType.EAGER) ...
1
vote
0answers
11 views

ADO, Stored Procedures and Closed Recordset

In the project I am working in, we have a component that lets us interact with product database. It has a function to run the query directly onto the database. It is using the code below IDispatch ...
0
votes
3answers
29 views

how to write the following in LINQ syntax

Just wondering how to write the following SQL in LINQ syntax select U.Id, U.FirstName, U.Surname, (select COUNT(COESNo) from COESDetails where InspectorId = U.Id) as Count from UserDetails U where ...
0
votes
1answer
22 views

how to get an array of unique key and associated value from multidimensional array with multiple keys and values

I'm firing a query on a particular table and getting this result : $results = array(3) { [0]=> array(2) { ["category"]=> string(1) "1" ...
0
votes
1answer
10 views

PDO drivers are installed, but connection test says otherwise

I'm trying to connect to my database using PDO drivers and as far as I know they are installed correctly. I have added the extensions to my php.ini file and the drivers are in the ext folder, I ...
0
votes
1answer
8 views

Crystal Formatting having 2 Subgroups?

I am struggling with organizing my data via crystal reports. I am attempting to essentially do a group by for 2 different things on the same level. I am currently unaware on how to make it so that ...
2
votes
0answers
17 views

Sql Server Network Configuration Protocols Not Available

After installing Sql Server 2008 32 bit, I tried to configure it to allow remote access. So I opened the sscm (sql server configuration manager) to set up the protocols to enabled. I did not find any ...
0
votes
1answer
16 views

compare AVG(integer) with AVG(integer) of a category

i have relation with three columns: ProductName, CategoryID and Price. i need to SELECT only those products which Price is higher than average product Price in given category. (eg when ...
0
votes
3answers
20 views

Android to SQL Server?

I have SQL server running on a computer on a local network, which is accessed directly by other computers on the LAN. Would it be possible to develop an android interface that can retrieve ...
1
vote
2answers
17 views

Error single-row subquery returns more than one row

This query returns collection of data. but I only need customer list. select * from customer where cust_acnt_nbr = (select cust_acnt_nbr from Asset where dstrct_id = (select dstrct_id from dstrct ...
2
votes
2answers
24 views

How to replace/remove multiple words from string in single statement

I have a table containing full body of water names in one column. ie: Golden Lake Blue Water Lake Muskoka River Sandy Bay I would like to select the water name, but not the type of water [lake, ...

1 2 3 4 5 9123
15 30 50 per page