User Profile
Collapse
-
I agree. There are some pretty good books on this subject. -
SQL 2000 Adding a column identifier
Hello everyone,
My query below works fine - but I'm having problems with identifying each of the 4 reports that are run in here. I need to have a column that has the name of the report run which are as follows: (This runs ALL at once)
1) Cable TV
2) Cable Modem
3) ADSL
4) Cingular
Each report is clearly listed below - but I just want to add something into my... -
SQL 2000 - LIKE Statement
Hello
I'm trying to filter out service orders numbers that begin with a letter - I just need numbers. For example my query would return:
11490
A6578
66451
12345
I want to filter out the service order with the letter A. I have tried this:
WHERE ServiceNumber LIKE <> (A%) but it doesnt work. Does anyone have a suggestionas to how to do this?
Thanks... -
-
CASE Statement - I'm in a bit of a quandry
Hello everyone,
I'm having a problem with trying to check a value from one column and add a value to the next column based on what the first column is. Below are my to CASE statements. What I need is to make field IN_OUT either "IN" for when field UpDnGrd is "Upgrade" and "Out" for when UpDnGrd is "Downgrade"
Kinda like this:
IF UpDnGrd = "U" THEN make... -
Found the solution - this works!
[Company] =
CASE
WHEN so.PhoneNum LIKE '999%' THEN 'Chester'
WHEN so.PhoneNum LIKE '998%' THEN 'Camden'
WHEN so.PhoneNum LIKE '997%' THEN 'Great Falls'
WHEN so.PhoneNum LIKE '803%' THEN 'Winnsboro'
END,Leave a comment:
-
RE: CASE Statement, works but.....
My CASE Statement works fine like this:
=============== =============== =============== ============
CASE
WHEN so.PhoneNum LIKE '999%' THEN 'Chester'
END AS Company, (Works!)
=============== =============== =============== ==========
But how can I get it to work checking more than 1 instance of PhoneNum?
This doesn't work:
=============== =============== =============== =========... -
OK - Never Mind, you were right, I had the solution - it works!
ThanksLeave a comment:
-
I don't know the solution. My examples do not have the correct syntax - that's what I'm looking for. What would the correct string look like for the solution?
ThanksLeave a comment:
-
CASE Statement
Hello
How would I go about using the CASE statement with the WHEN and THEN statements with a scenario like this:
=============== =============== ========---
CASE PhoneNumber
WHEN 9990000000 THEN City1
WHEN 8030000000 THEN City2
ect...
=============== =============== =============== =
What I want to do is check only the first 3 digits - just the 999. There... -
Round number off and change to currency
Hello -
Question... What would be the best way to round a number off and change it to currency with the below statement?
SELECT Cycle AS BillCycle, SUM(PrevBillAmt ) - SUM(Payment) + SUM(Adjustment) + SUM(LocServChar ge) + SUM(OtherChgCre d) + SUM(TotalTaxes) + SUM(TollCharge) AS Total,
**** My result is this:
2241661.6600
**** And want to change it to this:
... -
SQL Server 2000 Date Format
Thanks for both of your replies.
VBPhilly - your suggestion works but only on the final output by displaying the converted date field - but it doesnt let me query with the converted date field.
***** This works great!!!
SELECT REPLACE(REPLACE (CONVERT(VARCHA R(255), BillDate), '-
', ''), '/', '') AS Bill_Date,
But when I add my WHERE argument...Leave a comment:
-
SQL Server 2000 Date Format
Hello everyone,
How would I go about changing the Date format so my query can read it. The below example does not work but if I were to have a table with YYYYMMDD the below query does work. The query doesnt like dashes or forward slashes when working with date fields in certain tables - How can I say in my query
IF Date has dashes THEN change FROM 2007-08-01 to 20070801
or
IF Date has... -
Can't sort duplicate SQL Server 2000
Ok- Here is 50 Lines of Data that the query can be used on.
These Item codes are cable TV packages and what I;m trying to do is get a count on New Installs and Disconnects for a daily, weekly, or monthly reports. I then post these on the SQL Reporting Services web via visual studio.NET - anyways...
In the data below there are some good examples of data...Leave a comment:
-
Ok - This is what I have so far:
=============== =======
SELECT COUNT(a.Order#) AS Total, a.Item
FROM dh_JoinView a, dh_JoinView b, dh_JoinView c, dh_JoinView d
WHERE a.Order# = b.Order# AND a.Order# = c.Order# AND d.Item
LIKE 'AA%' AND c.Item LIKE 'AB%' AND b.Item = 'FLCHS' AND a.Item = 'HBOCH'
GROUP BY a.Item
=============== =======
...Leave a comment:
-
Try this - When I want to Query all the days in a month - for example July1 thru July31 would be:
SELECT MyData
FROM MyTable
WHERE MyDate BETWEEN '20070701' AND '20070731'
The date format has to be the same as whats in your table - provided that you DO have a Date field.Leave a comment:
-
Can't sort duplicates SQL 2000
Wow - great stuff, Thanks!
I actually ran your example and it works - but I cant seem to get it to work with my FROM statement below - I'm not sure how to plug in the t1 b and t1 c
So make T1 = FROM ctcmaster.dbo.S erviceOrders AS so INNER JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# INNER JOIN
ctcsec.dbo.SV07 AS sv7 ON
...Leave a comment:
-
Yeah - that makes sense but.....
What if I'm using JOINS already - here are my actual tables:
=============== =============== =============== ====
SELECT so.Order#, sv7.Item, so.soCreated,
FROM ctcmaster.dbo.S erviceOrders AS so JOIN
ctcsec.dbo.SV02 AS sv2 ON
so.order# = sv2.SV2SO# JOIN
ctcsec.dbo.SV07 AS sv7 ON
so.order# = sv7.Order#
=============== =============== =============== =====...Leave a comment:
-
Thanks for responding - Not sure about the FROM part. What does the T1a, t1 b, and t1 c represent? Anyway you could kind of break it down it simple terms for me?
I ge the "WHERE" logic - (sort of) I would like to say IF b.[Feature] = 'AA10' and c.[Feature] = 'FLCHS' and a.[Feature] = 'STRCH' THEN return ONLY 'STRCH'
Thanks...Leave a comment:
-
Can't sort duplicates SQL Server 2000
Hey Everyone -
What would be the best way to sort data that has common fields? Here is my example:
Feature Date Order Number
=============== =============== =============
FLCHS 20070814 073576
STRCH 20070814 073576
AA10 20070814 073576
What I need is just one of the Items under feature based on a Hierarchy of the features. Its from the same order and I have...
No activity results to display
Show More
Leave a comment: