SELECT h.FITEMNO, SUM(h.FSHIPQTY) AS TOTAL_QTY FROM ARTRS01H.dbf h WHERE h.FCUSTNO=@FCUSTNO GROUP BY FITEMNO
NitinDhapte
Posts
-
Distinct records on old school foxpro database file -
SQL search questionDear Jassim, If you know the exact column list to search data For Example : 1. company_name 2. first_name 3. last_name Then you can write down your query as below :
SELECT * FROM contacts WHERE (company_name like '%'+@searchText+'%' OR first_name like '%'+@searchText+'%' OR last_name like '%'+@searchText+'%')
Secondly, If you don't know about the column list then let me know the I can write a dynamic query for you.
-
how to updat a column from start pointHi, Try this : ColumnA is the primary key of table : tableName
UPDATE tableName SET columnB = 9 + t2.RowNum FROM tableName t1 INNER JOIN (
SELECT ROW_NUMBER() OVER (ORDER BY columnA) RowNum,columnA FROM tableName) t2 ON t1.columnA = t2.columnA -
how to updat a column from start pointHi, Try this : ColumnA is the primary key of table : tableName
UPDATE tableName SET columnB = 9 + t2.RowNum FROM tableName t1 INNER JOIN (
SELECT ROW_NUMBER() OVER (ORDER BY columnA) RowNum,columnA FROM tableName) t2 ON t1.columnA = t2.columnA -
How to select the records who are completed exactly years comparing with joining date and todays dateHi, Try below :
DECLARE @JoiningDate DATE
SET @JoiningDate = '10/10/2013'IF (YEAR(GETDATE()) > YEAR(@JoiningDate))
BEGIN
IF (DAY(@JoiningDate) = DAY(GETDATE()) AND DAY(@JoiningDate) = DAY(GETDATE()))
BEGIN
/*
This will exceute on every year of joining date.
Below is the print statement to check the testing result.
*/
PRINT CONVERT(NVARCHAR,(YEAR(GETDATE()) - YEAR(@JoiningDate))) + ' Year(s)'
END
END -
SQL Server 2012 Agent Job & stored procedure issue URGENTIf you want to excecute your query on every 31st December add a below condition
IF (MONTH(GETDATE()) = 12 AND DAY(GETDATE()) = 31)
BEGIN
/*
This will excecute on every 31'st December
Write down your query
*/
END -
SQL Server 2012 Agent Job & stored procedure issue URGENTIf you want to excecute your query on every 31st December add a below condition
IF (MONTH(GETDATE()) = 6 AND DAY(GETDATE()) = 16)
BEGIN
--Write down your query
END -
Join Query returning duplicated rowsDear, It happens only when the multiple records are available with the correspondence of [Sheet1$].Id into the [Sheet2$] ([Sheet2$].Sheet2Id) Or [Sheet3$] ([Sheet3$].Sheet3Id). Please check with the multiple records into the Both the Sheet 2 & 3. If you dont want to remove the multiple records from those sheets then Add distinct clause into the SELECT Query.
SELECT DISTINCT
[Sheet1$].Sheet1DetailId,
[Sheet1$].Sheet1Id,
[Sheet2$].Sheet2Id,
LTrim(RTrim([Sheet3$].Mission)) + '-' + CStr(Format('01-' + [Sheet3$].Sheet3Date,"mm/dd/yyyy")) AS Sheet3DateColumn,
[Sheet1$].one,
[Sheet1$].two,
[Sheet1$].three,
[Sheet1$].four,
[Sheet1$].five,
[Sheet1$].six,
[Sheet1$].seven,
[Sheet1$].eight,
[Sheet1$].nine,
[Sheet1$].ten,
LTRIM(RTRIM([Sheet2$].Name)) AS Sheet2Name
FROM (([Sheet1$])
INNER JOIN [Sheet2$] ON [Sheet1$].Id = [Sheet2$].Sheet2Id)
INNER JOIN [Sheet3$] ON [Sheet1$].Id = [Sheet3$].Sheet3Id