I have a table that currently is a long list of devices and information about when they were sold. I need to take the table which would look something like this:
Item | Time Sold
--------------------
A 05/2010
B 04/2010
C 03/2010
A 04/2010
A 05/2010
And then have a table with the item a...
Are table variables created in memory or in tempdb? Same for
short temp tables?
...
I was working on an Access database which loved auto-numbered identifiers. Every table used them except one, which used a key made up of the first name, last name and birthdate of a person. Anyways, people started running into a lot of problems with duplicates, as tables representing relationships could hold the same relationship twice o...
I volunteer for a local non-profit that gives out toys and food during the holiday season. One way that I am helping them is by putting their gift/food requests online. This way instead of manually entering 1,000 or so names manually into Excel over the course of 15 hours they can simply click on a link and have the whole thing exported ...
I'm working on a system at the moment which, for no apparent reason, has been split into no fewer than 7 separate databases so I'm looking to merge everything together. The application is used within the client's company but a restricted version is also exposed to the internet.
At the moment, a separate 'internet' version of the databa...
I currently have a SQL query that returns results based on a dynamic number of keywords passed in.
I convert the list of keywords into a table and join to it.
SELECT * FROM Table1
INNER JOIN
dbo.udf_List2Table(@Keywords, ',') ON (Field1 LIKE '%'+Keyword+'%')
This is working fine but it returns all rows that contain an...
I have a simple SQL statement.
Select distinct value from tablename where value not like '%TEST%'
How do I write this in Linq to SQL syntax.
I tried the below statement but it doesnt seem to work.
var p = (from c in tablename where !(c.value.ToUpper().Contains("%TEST%"))
select c.Value).Distinct().ToList()
...
I have data in the following format in a table:
Acct# Amount
123 3.4
123T 4.5
124 2.3
124T 4.5
125 1.2
125T 2.4
How do I create a select statement where it totals up the account number as 123+123T and gives the following output:
123 7.9
124 6.8
125 3.6
...
Here are some example numbers:
987
1001
1004
1009
1010
1016
1020
1050
For example, I would like select the top 4 numbers that close to the given number 1009 (so, the results would be 1001, 1004, 1010 and 1016), how should I write the SQL expression?
...
Hi all
Im having some problems combining data from 2 tables in to 1 query.
Now I have one table-nr1 with raw data of restaurants and in the other table-nr2 I have a number of restaurants that have been graded.
So, now I want to select all restaurants and at the same time select grades of that restaurant from table-nr2 and get the av...
Hello. I need to retrieve from database list of manufacturers (table producenci), but only from particular products category. Actual query looks like this, but it returns 0 records. If I remove WHERE, it returns whole table producenci.
SELECT DISTINCT (
pr.id
), pr.nazwa
FROM producenci pr
LEFT JOIN produkty ON pr.id = produkty.produce...
I know how to sort a result set:
SELECT * FROM `People` ORDER BY `LastName` ASC
However, the results that have an empty LastName show at the beginning. How do I sort in ascending order, and show the NULL results at the end instead of the beginning?
...
Ok this is what i need to model...
I have 2 objects, that can exist seperately - lets say man and woman, neither needs to know about the other. But once they get get "married" it can only be married to each other.
In other words, I'm trying to create 2 tables, 1 table has a FK to the other, that is NULLABLE. When i try to set the rela...
I am trying to integrate a MySQL database with Salesforce but am having trouble with part of the query logic.
I enter this query:
SELECT occupation_name FROM skillsmatch_skillsprofile GROUP BY time_updated ORDER BY time_updated DESC LIMIT 0,5
But get this error:
<> missing operator... SELECT>>>> <<<
Any idea where I might be going w...
Hi,
I'm an SQL newbie and trying to figure out how to insert multiple table entries in one SQL statement.
Here is my code:
INSERT INTO [Students](P_Id,FirstName,LastName,class,city,Phone)
SELECT 123,'Avi','Davis',2,'Tel-Mond','03-456789'
UNION
SELECT 234, 'Dani',2,'Dimona',' 02-111'
UNION
SELECT 345,'Itzik',3,'Ariel', '03-2222'
UNION ...
Hello i have two tables:
**prices**
id
id_stock
price
date
**stocks**
id
stock_name
active
now i have to set stocks.active=0 for each stocks that has the MAX(prices.date) > 15 days (of a date i have to pass)
This is my query, but it's very very slow!!!
update stocks set stocks.active=0 where stocks.id IN (
SELECT prices.id_stock
...
I'm assuming some sort of security constraint, but if I have access to all folders on a PC, why allow some folders and not others.
What is the criteria for a folder being a valid backup / restore / attach folder?
Any advice appreciated!
...
I've got a simple table "Logins" with two columns:
username (nvarchar)
logged (datetime)
It's really simple, just records the username and datetime when someone logs into my web application. Sometimes, however, people login a few times in one minute... I want to try to run a query to filter those results and only have it return one ...
Table schema is set up something like this:
userID Points timestamp
1 40
3 20
1 10
4 15
3 5
Need to be able to present a report that shows the following:
Total Points Allocated for the Day (0 if none allocated), (nice to have) To what userID's the points were allocated to ...
I need to write a SQL function that will allow me to strip an email address to the bare domain name. EX: I would make [email protected] read as [email protected]. This is most likely very simple but, I cannot seem to find any information on it.
...