It worked! Thank you so much, so simple and so briliant!
1)But I don't understand part of syntax, what means "select min(WK_END) WK_END," in subquerry?
(select min(WK_END) WK_END, sku, price from Table1 group by sky, price)?
2)Also I have a new chalenge - if PRICE in the fisrt week of analyzed...
Hi all,
My table have just few fields. I need to compare price in current week to prior week, determine PRICE DROP and put flag for this record.
WK_END SKU PRICE
-------------------------------------
07/18/03 5565317330 1.29
07/25/03 5565317330 1.29
08/01/03 5565317330 1.29...
I have to import to SQL server text file with field in exponential format:
|40|10|1|+3.00000000000000E+000|+6.70000000000000E+000|+6.70000000000000E+000|
Is any one aware of the best way to that? To import as CHAR and then convert to numeric? Too many fields to convert! Your help greatly...
I have messed up the script I'm using
SELECT DISTINCT
vndnumber,
vendorname=MAX(vendorname)
INTO DBO.P_VENDOR
FROM DBO.T_VENDOR
GROUP BY vndnumber
Example:
vndnumber vendorname STRING LENGTH
------- ------------------------------------...
Hi,
I have a very silly question
If I have three records
vndnumber vendorname
---------- --------------
296333 Kraft Inc.
296333 Kraft Inc
296333 Kraft Inter.
and I need to group by vndnumber and make one record from these three and I was told to take...
I would create a new field CODE_new =
CASE LEN(ISNULL([A].[Code],''))
WHEN 0 THEN CAST('' AS CHAR(30))
ELSE
CASE WHEN PATINDEX('%[1-9]%', [A].[Code]) = 0 THEN CAST('' AS CHAR(30))
ELSE
CAST
(
CAST
(
REPLACE
(
CASE WHEN PATINDEX('[0-9]'...
by analyzing data it's more likely: last two digit is year,
first 1 or 2 are month and middle two digit are dates,
I have padded with leading zero and converted to char
so now example values look like these:
112300
042101
052301
071901
Hi, almost fanny, but
nothing works!
I have a numeirc field and value in this field are (examples):
112300
42101
52301
71901
It's total over 3 million records in this table.
How to convert this field to datetime?
Thank you
I have two related tables, Invoice Header and Invoice Detail. They have two key fields: Vendor# and Invoice#. What is the best way to find orphaned records - records in Detail table that have no match in Header table?
Takes only few seconds to create a view but it takes forever to read from view! Is it common problem or it's a problem on iur server, I did not use view before. Please respond, I need to figure it out! have no time!
Thank you!
What is wrong with this syntax?
select
vnd_nbr = ltrim(f1),
vnd_name = ltrim(f2),
invnbr = ltrim(f3),
invdt = f4,
case when ltrim(rtrim(f5))='1' then
case when ltrim(rtrim(f6))='X' then
cast(f7*-1 as numeric(15,2))
else
cast('0' as numeric(15,2))
else
case when...
I want my output table to be:
VCH VEN PTYPE X Y
1571 33 03 264.15 0
4472 708 03 0 -108.26
X value - line record #1 with PTYPE='03' for ven 33
Y value - line record #2 with PTYPE='03' for ven 708
Here is example of my input table
VCH VEN PTYPE AMT
1571 33 60 -264.15
1571 33 60 250.82
1571 33 60 7.11
1571 33 60 6.22
1571 33 03 264.15
1571 33 03 -264.15
4472 708 60 -108.26
4472 708 03 108.26
4472 708 03 -108.26
For each ven and vch I have two line with ptype='03'
If AMT in line =1 them AMT...
I need to build invoice table based on accounts payable table. Depends on value in some fields, I need to populate invoice amount field. Actualy I have a RPG program printout and I need to translate this program in SQL code. Part of RPG program adds line count to program. If record line for...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.