The following code works without problems:
select donem, mekankodu, count(yayin_kodu) yc,
SUM(CASE WHEN iade =0 THEN 1 ELSE 0 END) yys
from
( select donem,
bayi_adi,
bayi_kodu,
x.mekankodu,
mekan_adi,
mekan_tipi,
yayin_kodu,
yayin_adi,
...
Hello,
This is a really tricky question to ask as its very hard to explain what I'm after. Here goes though!
SELECT
Stock.*,
REPLACE (Description, '&', '&') as Description,
PRD1.RuleValue AS Price,
PRD2.RuleValue AS WasPrice,
PRD2.RuleValue-PRD1.RuleValue AS Save
FROM
Stock INNER JOIN
StockCategoryMem...
Hey all,
I wanted to know what is better performance-wise:
to put the conditions in the JOIN? (x JOIN y on x.hi = y.hi AND ....) or maybe to put it under the WHERE, and leave the JOIN only with the crossing condition.
thanks folks
...
Hello,
I'm looking for any suggestions to optimize the following PROC SQL statement from a SAS program. The two tables involved contain around 5 million records each and the runtime is about 46 hours.
The statement is looking to update a "new" version of the "old" table. Noting a column if the "old" table, for a "PK_ID", was listed ...
I hear a lot about performance problems about lazy loading, no matter if at NHibernate, Linq....
The problem is N+1 selects. Example, I want all posts and its users, at foreach I lazy Load Users, them I need one select for posts, plus N select for each user.
Lazy Loading:
1 - select ....from post
N - select ....from user
The "good" ap...
Hello All, I have an SQL Table which consists of 1 column only
Column Name
A
A
A
B
B
B
B
C
D
D
E
I need an SQL Code that returns the cut points. For the table above, it will return this:
Column Name
3
7
8
10
11
3 is the end of A's and 7 is the end of B's and 8 is the end of C's and so on...
Let's see what can...
I'm kinda ashamed of asking this since I've been working with MySQL for years, but oh well.
I have a table with two fields, a and b. I will be running the following queries on it:
SELECT * FROM ... WHERE A = 1;
SELECT * FROM ... WHERE B = 1;
SELECT * FROM ... WHERE A = 1 AND B = 1;
From the performance point of view, is at least one...
Have a table users and there is a field invited_by_id showing user id of the person who invited this user. Need to make a MySQL query returning rows with all the fields from users plus a invites_count field showing how many people were invited by each user.
Something like this:
SELECT
User.*, Count.count
FROM
users AS User,
...
I have an asp.net web page with a simple search text box that returns matching rows from a MSSQL 2005 database. It is currently using a LIKE statement to bring back matches, but forces the user to to type an exact phrase. Users want a more Google search type experience and so I have decided to set up and index the needed tables with FTS....
I am trying to insert a record and get its newly generated id by executing two queries one by one, but don't know why its giving me the following error.
Object cannot be cast from DBNull to other types
My code is as below: (I don't want to use sql stored procedures)
SqlParameter sqlParam;
int lastInsertedVideoId = 0;
using (...
I have a report and it seems so insist on printing in portrait mode and splitting the report across two pages.
How can I make the web version specify landscape automatically, and also have it scale to fit on one page?
...
This may be a dumb question. But I just received permissions to read/write to this DB. I see the tables of the DB, except for one. I can select from it, But I cannot see it in the Object Explorer. I restarted my computer, refreshed the object explorer and everything. Is there a restriction on viewing this table?
...
Where can I find a generic editor (JSP using Oracle's ADF) for create, read, update, and delete on any table?
Example usage:
User selects the name of a table.
User then adds a new row, or updates/deletes an existing row.
User saves the changes.
Foreign keys would appear as drop-down lists, and all others as af:inputText. (The user-f...
Hi,
I have a MSSQL 2005 database with a lot of records that were added since last backup. I want to make another SQL script that puts result values into string representing INSERT statement that I will save for later use.
Something like:
SELECT 'Insert INTO tabname columns VALUES("+Column1"',')' FROM XY
Or simple example:
Column A,...
Is it possible to create and use a user defined function in a report query?
Something like this:
if OBJECT_ID('userFunc', 'TF') is not null drop function userFunc
go
create function userFunc(@id int)
returns @tbl table
([id] int)
begin
insert into @tbl (id) values(@id)
return
end
go
select * from userFunc(1)
if OBJECT_ID('userFunc',...
I would like to run a query like
select ... as days where `date` is between '2010-01-20' and '2010-01-24'
And return data like:
days
----------
2010-01-20
2010-01-21
2010-01-22
2010-01-23
2010-01-24
...
A form field value like 45,234 is to be inserted into the DB as 45234. When I try to do insert for 45,234, all it gets into the DB is 0.Note:- I am able to insert 45.234as 45.234 in the SQL DB.
The form field is named costOfShares, which is to be inserted into the table ShareVales (SQL Server 2005). I am using CF8.
SQL
table:-ShareVa...
DECLARE @Route geography
SET @Route = geography::STLineFromText('LINESTRING(-0.175 51.0, -0.175 59.0)',4326)
DECLARE @Route2 geography
SET @Route2 = @Route.STDifference(geography::STPointFromText('POINT(-0.175 52)', 4326))
SELECT @Route2
Why does @Route2 evaluate to LINESTRING (-0.175 59, -0.175 51) instead of a MULTILINESTRING consi...
Is it possible to recieve only the structure of the table even if its emtpy and put the field names in an array. if so wich sql command makes that possible.
thanks
Matthy
...
Is there a way to get SQL Server 2005 to query 3 or more separate Access databases (each returning 1 record) in one SQL statement?
...