Questions tagged [select-query]
176 questions
0
votes
1 answer
Creating Generic MySQL SELECT Statement in C#
There are a few similar questions, but none of them seem to answer my problem.
In my application I use lots of different SELECT queries and I don't want to write a method for every one, so I'm trying to create a generic one that I can just pass the…

user7991284
- 1
- 1
0
votes
2 answers
How does the SELECT query work on multiple columns without using comma in between column names?
I'm studying SQL from w3schools SQL Tutorial
While studying the chapter SQL Aliases I come across following query :
SELECT CustomerName, Address+', '+City+', '+PostalCode+', '+Country AS Address
FROM Customers;
If you observe closely the query is…

PHPLover
- 1
- 51
- 158
- 311
0
votes
0 answers
SELECT hanging with SOS_SCHEDULER_YIELD lastwaittype
I've been experiencing a strange situation with a specific SELECT on SQL Server 2008 Standard.
I have a proc that executes a bunch of commands.
One of the last tasks is to insert the result of a select statement into a table. This proc is executed…
0
votes
1 answer
Is it valid syntax to have a column name prefixed with a number, e.g., 3name?
While toiling on a report last friday, I noticed a column that returned "3" for every row even though the data in the table said otherwise. After squinting very hard at my sql, I noticed a typo in my select list that was causing the problem.
Why…
user3764097
0
votes
3 answers
How to ignore duplicate records in sybase?
I'm trying to retrieve only unique records from a table, but I guess something is wrong with my query.
select distinct RIID, duplicateInfo from duplicateRecords where RIID > 3920011
When I execute above query I get this result
RIID | …

Fazil Mir
- 783
- 2
- 9
- 23
0
votes
0 answers
mysql - convert unix timestamps to datetime and how add other columns to the query?
mysql - I have a table , a column of unix timestamps called time, which I have already changed to datetime format, but I can't select other columns of my table.
To change the unix timestamps I have used the following statement:
SELECT
from_unixtime…

jeffreypc
- 1
- 1
0
votes
1 answer
SQL: how count how many rows contain multiple keywords
I have a dataset that looks like this:
And I would like to do a select query where I can set manually keywords (e.g. city, beautiful, rains, trees) and get a count of how many times these keywords appear. In this case the result should be
0
votes
3 answers
NOT IN scenario in Crystal Report with multiple datasources
I need to do the following select for my Crystal Report:
Select * from Table1 where ID not in (select ID from Table2 where mydate = @param)
And to make things more complicated Table 1 & Table 2 are on two different servers (one is Access, one is…
0
votes
1 answer
Mysql select query to find a value in certain range
I have a items table,
id item min_price max_price
-----------------------------------
1 item1 100 500
2 item2 150 400
3 item3 410 700
4 item4 330 700
5 item3 420 …

Vinod VT
- 6,946
- 11
- 51
- 75
0
votes
2 answers
Having trouble creating a MYSQL-Query which selects Data from two tables
I have some trouble doing an exercise in MYSQL.
There are two tables:
Table Employees:
ID Name InstitutionID
1 Tom 1
2 Bert 1
3 Steve 2
4 Marcus 3
5 Justin 1
Table…

Samy Dressel
- 143
- 1
- 13
0
votes
1 answer
Retrieving values from SQLite table iOS
As I'm new to iOS programming,I have a doubt in retrieving data corresponding to a particular integer id from SQLite database table?
This is what I tried but seems wrong:
NSInteger id= sender.tag;
FMResultSet *rs = [self.databaseFM…

Jas
- 3,207
- 2
- 15
- 45
0
votes
1 answer
Get the user with the 1000th point (SQL query)
I am trying to just do a query that will illustrate which student from school_id 1 has got the 1000th point - in this case it is 'Sharon'
+++++++++++++++++++++++++++++++++++++
# id # school_id # student # points #
# 1 # 1 # Harry # 100…

Zabs
- 13,852
- 45
- 173
- 297
0
votes
2 answers
Need to select a column value based on another column value if its true in sql?
Table structure
id col1 col2
1 data1 false
2 data2 true
I tried
select id, case col2 when true then col1 from table
and it is showing an internal server error. I want to select the col1 from table when the corresponding col2 is true.

Jaison Abraham
- 11
- 1
- 4
0
votes
1 answer
SQL Server- Select Into another Select Got Error
I create query to get my goods in my database as shown below
SELECT
Goods.GoodsID ,Max(Price)
ExistNumber AS ExistNumber ,
(SELECT p.ValueText
FROM STR.GoodsProperties gp
INNER JOIN PRP.Properties p ON p.PropertyID =…

Rasoul Matinfar
- 11
- 3
0
votes
1 answer
How to create anonymous field with values in oracle select query
I have following select query which returns KPI_DEF_ID values.
Select KPI_DEF_ID from RATOR_MONITORING_CONFIGURATION.KPI_DEFINITION WHERE KPI_DEF_ID NOT IN (Select KPI_DEF_ID FROM KPI_STATUS);
The query returns the…

Andrew
- 3,632
- 24
- 64
- 113