Help In Solving SQL Quary
Jul 6, 2007
Hi,
I am new to the forum. I need help in solving the following quary.
Table structure:
Region: region_id, name
Employee: employee_id, name, region_id
Sales: sales_id, employee_id, sale_date, sale_amount
-there’s an individual entry in the sales table for each sale
Problem
Write a query that returns a list of the Regions and the number of employees in each region. The employee only gets added to the count if they had total sales greater than $50,000 last month. Sort the information by the number of employees per region who fit this criteria.
Thanks,
Divya
View 16 Replies
Feb 8, 2004
Hi All,
It's probaly still Sunday in most areas, but hope I get a quick response on this 1.....
I'm doing ASP with SQL 2000. And for the moment, I write inline SQL Scripts into my ASP pages. Store procs can only come later ( don't ask why...).
So as most of u will know, if any characther from the textboxes comes with a ' , everything will go haywire!
Thus, I'm using this existing code to solve the prob:
FAddress = Replace(FAddress, "'", "%%")
Call OpenDB()
SQL_query =" SET NOCOUNT ON" & _
" set DateFormat dmy" & _
" declare @FAddress varchar(100)" & _
" set @FAddress='"& FAddress &"'" & _
" set @FAddress=(replace(@FAddress,'%%',''''))" & _........and so on
Is there a better way? Some problems from this is if I am inserting large info in a text datatype, I can't do it.....
Some code or function that I can call and apply to my entire system without recoding alot....:)
SQL and ASP jedi masters...please enlighten me.
View 3 Replies
View Related
Mar 14, 2008
I have in SQL Table1 the following values in Field1:
ABC
ABc
AbC
abc
aBc
abC Select Field1 From Table1 Where Field1 = "AbC"
I get all six records, not just the one record (AbC) that I want to retrieve. How do I tell the select statement to be case sensitive?
my asp.net statement is given below DataRow dr1 = ds.Tables["Login"].Select("UserId ='" + txtUserId.Text + "'And Passwords ='" + txtPassword.Text + "'")[0]; i m using datarowso i need a helpi have quary but i don;t know how can use DataRow dr1 = ds.Tables["Login"].Select("UserId ='" + txtUserId.Text + "'And Passwords ='" + txtPassword.Text + "'where CONVERT(binary(5),Userid)=CONVERT(binary(5),'" + txtUserId.Text + "')'" )[0]; this give me error "Where condiction need operator"waiting for reply
View 2 Replies
View Related
Jun 9, 2007
I want to write a report quary which will dispaly total of amount,hamali,servicetax,other,granttotal for a particular service
for a financial year
i have tried useing cross-tab but it is not working
OUT PUT OF QUARTY SHOULD LIKE
SERVICE NAME DATA 2007-APRIL 2007-MAY
PARCELAMOUNT 29503000
HAMALI 200256
SERVICE TAX 3010
OTHER 2060
GRANT TOT 3200 3326
View 2 Replies
View Related
Feb 4, 2005
hi,
i have two tables with parent/child relationship - pipeline and pipelineStatus. the select statement like this:
SELECT *
FROM pipeline INNER JOIN
pipelineStatus ON pipeline.id = pipelineStatus.parentID
i got multiple records for each pipeline.id because of multiple records of pipelineStatus. Is it possible to get only one record for each pipeline.id with last record of pipelineStatus table?
(stored procedure ok)
thanks advance for answering my question.
View 7 Replies
View Related
Mar 6, 2008
I am very new to SSIS. Can someone give me a basic out line to this problem. I kind of understand control tasks, data flow, etc... but not in details(watched couple of webcasts). I need to see something like below in action to understand this better.
Basically, I need to process a flat csv file on daily basis and load it into a table. As I am loading the records, I will need to verify(on a key column) to see if record exists in table already. If so then just update the record otherwise insert a new record. When I find a record, I need to possibly do a checksum on a set of columns before I do update. So, only update if these set of columns are different from file vs. table. I also need to keep performance in mind as I am processing this record one at a time looking up this record. I am thinking this should be fairly easy but I am getting little lost in control tasks and dataflow as to what goes on what. By the way I am using visual studio 2005 and sqlserver 2005.
I would appreciate your help. thanks again. I dont mind an example solution file.
View 3 Replies
View Related
Nov 19, 2006
Hi,I am new to SQL express and try to solve the 4GB size limitation.Is there a possibility to create a new database file every time I getto the limit?How can I do that with C#? how can I create new database file everytime it gets full?Can I be connected to two database files at the same time (the full dband the new db)?thanks in advance,oren
View 1 Replies
View Related
Dec 12, 2007
Hi there
After performing a side-by-side instalation of SQL2005, I am not able to open Enterprise manager (for managing SQL2000 instance). It aborts with some errors related to mmc.exe not being able to use a couple of dlls: semsfc.dll and lmmc.dll.
I've tried to unresgister/register them but I get the following error message:
semsfc.dll is loaded, but the dllRegisterServer entry point was not found...
This file can not be registered .
I found a similar complaint in the VB forum, which recomended to use Reagasm but I couldn't understand it really, and I'm not sure if it applies to this SQL server issue.
Thaks for your help
ds9
View 4 Replies
View Related