I have a simple inheritance in my model. The class of an entity is defined by a field (RecordType: int). Now I would like to create a SQL to Entities query where I need to filter only one inherited class.
When I use
ctx.CreateQuery<InheritedEntity>()
it fetches all the classes, rather than only InheritedEntity class.
I tried referr...
Hello,
I've created a #temp table in SQL containing duplicate records.
I would like to remove from my primary table all of the records contained in this temp table. I see samples to do this but they seem to all invovle selects, and I already have my select in the temp table.
Here's what it would look like in pseudocode:
DELETE FROM ...
Hi,
I am using geography.STDistance() to return the distance between two single point locations. I'm curious as to which measurement is used for the return value? Is it in KM's, miles or perhaps some other?
I'm getting results back upwards of 250k but i've no idea if im doing something wrong with my TSQL as these are historical location...
Hello all,
I am rather new to SAS and I have run into a problem that I think probably has a better solution than what I've found so far.
I need to update a Oracle db table that has around 1 million rows with data from a SAS data set that has about 10,000 records.
I used an update statement within proc sql, but it takes hours to upd...
Hi,
I have to manage a table on a large database with over 20k records (the db size is 25MB). I use standard queries like SELECT\INSERT etc. programmatically using SQLITE framework. But the app on the Device is VERY VERY slow. When I tap the icon, the Default.png freezes for 10-20 seconds and the app crashes. When I run it on the simulat...
I'm trying to select two distinct numbers id1 and id2 from the following table:
tb_table1(
bigint id1
bigint id2
bigint userid)
if I do
select distinct id1, id2 from tb_table1
I'll get, for example, two rows, (111, 222) and (222,111).
I only want one of those rows since I don't care which column, id1, or id2 that the result ge...
Hey, All:
I've been looking for a free library/source code to format SQL queries, preferably in .NET, for quite a while. Even after searching some of the responses here on SO, I'm almost at the point where I'm willing to believe that nothing like this exists.
The closest thing I've found, a project called sqlformat, does not seem to b...
I have two tables that look a little like this
AGR_TERR_DEF_TERRS
ID
DEF_ID
TERRITORY_ID (foreign key links to TERRITORIES.ID)
TERRITORIES
ID
NAME
PARENT_ID
(parent_id and id are recursive)
Given two DEF_IDs, I need a function which checks whether the territories of one is a complete subset of the other.
I've been playing...
Example of what I want to do:
select a.* as a_, b. as b_* FROM a, b WHERE a.id = b.id
...
Hi Guys,
I am trying to build a .NET web application using SQL to query AS400 database. This is my first time encountering the AS400.
What do I have to install on my machine (or the AS400 server) in order to connect?
(IBM iSeries Access for Windows ??)
What are the components of the connection string?
Where can I find sample codes o...
Hi I have an order table and a payment table which are linked by order_num. I would like to get entries from order table who have entries in the payment table of PaymentType 'A' as well as PaymentType 'B' and their amounts match. Example order number 411 should only be returned to me if it has at least two payments and one of them is p...
I have a float value that is derived from dates being subtracted. How do I convert this float value into minutes? Perferably if I could convert it into hours and minutes otherwise just minutes....
For example here are some values I have:
4.12676944443956
3.91463738425955
0.102466473770619
0.0308067515434232
0.0564043209888041
The...
A table lists multiple events where each event has four attributes (columns), call them A, B, C, P
It would be simpleto pivot to get a table with columns for A, B, C, P=1, P=2, P=3, etc.
However, I need the columns to be A, B, C, P<1, P<2, P<3, etc.
In other words, if a row of the "simple" way were X, Y, Z, 7, 3, 5, 2 then what I actu...
What is the SQL MODE in MYSQL (or any RDBMS)? Also what is the best option to have for the SQL MODE and Why?
If i could have a layman explanation with a example it would be great!
Thank you in advance ;-)
...
how does one insert records from one table to another that has a unique index in the destination table without going through the insert and then removal of duplicates by deleting the index?
INSERT INTO forms(url,feedUrl, dateadded)
SELECT url, feedurl, dateadded
FROM Book3 T2
where not exists(select * from forms T1 where T1.url = T2.url...
Hello,
In my code, I need to test whether specified column is null and the most close to 0 as possible (it can holds numbers from 0 to 50) so I have tried the code below.
It should start from 0 and for each value test the query. When @Results gets null, it should return. However, it does not work. Still prints 0.
declare @hold int
decla...
I'm sure there are, I'm wondering what they are and if there is any upgrade/conversion documentation relative to taking a standard SQL server database and moving it to SQL Azure.
...
Hello,
Tiredness prevents me from finding this one... Say you have the following tables:
Parent
PARENT_ID (LONG)
Child
CHILD_ID (LONG)
PARENT_ID (LONG, FK)
HAS_GRADUATED (BOOLEAN)
I want a query to return the following true (1, in the case of Oracle) if the parent has at least one child that has graduated, and false (0, in the ...
For example, the table has columns MYINDEX and NAME.
MYINDEX | NAME
=================
1 | BOB
2 | BOB
3 | CHARLES
Ho do I find row with highest MYINDEX for specific NAME? E.g. I want to find ROW-2 for name "BOB".
...
I have 2 queries which display 2 different values but the results from one query are unexpected.
Query1:
SELECT SUM(T.amount_reward_user) AS total_grouping
FROM fem_user_cards UC
LEFT JOIN fem_transactions T USING(card_number)
LEFT JOIN fem_company_login FCL
ON T.fem_company_login_id=FCL.fem_co...