Search Results

Showing results 1 to 16 of 16
Search took 0.00 seconds.
Search: Posts Made By: huangzhi ; Forum: MS SQL and child forums
Forum: MS SQL 18 Days Ago
Replies: 6
Views: 579
Posted By huangzhi
I think there are some (ClientID = 1126) in table Receipts.
Change your SQL to:


SELECT Clients.ClientID, Clients.WholeName,
SUM(CASE WHEN Payments.Creditorid = 0 THEN Payments.Amount ELSE...
Forum: MS SQL 19 Days Ago
Replies: 6
Views: 579
Posted By huangzhi
I think there are data double in table Receipts.
Please give some data for example.
Forum: MS SQL 24 Days Ago
Replies: 4
Views: 542
Posted By huangzhi
Try code below


set nocount on
CREATE TABLE #tmpName (ID int, [Name] varchar(255))
CREATE TABLE #tmpRelation (ID int, ID_Parent int)

INSERT #tmpName (ID, [Name]) select 1, 'value1'
INSERT...
Forum: MS SQL 26 Days Ago
Replies: 4
Views: 542
Posted By huangzhi
Can u give some data and the result you want?
or you can see http://www.daniweb.com/forums/thread114466.html.
Forum: MS SQL Jul 29th, 2009
Replies: 2
Views: 687
Posted By huangzhi
maybe you can use CASE ... WHEN ... END command like below:


select cast(case when exists (SELECT * FROM UserList WHERE UserName = 'Tester') then 1 else 0 end as bit)
Forum: MS SQL Dec 27th, 2008
Replies: 3
Views: 1,108
Posted By huangzhi
Make it subquery like below:


select [Year], [Month], sum([Benefits Rating]) as [Benefits Rating], sum([Facilities Rating]) as [Facilities Rating]
from (...... your origin query ......) X
...
Forum: MS SQL Nov 24th, 2008
Replies: 3
Views: 882
Posted By huangzhi
Try this command:

select T1.idx, T2.idy, T2.u
from Table1 T1 right join Table2 T2 on
T1.idy = T2.Idy and T1.idx = 'one'
Forum: MS SQL Nov 19th, 2008
Replies: 4
Views: 629
Posted By huangzhi
change your command into:

select *
from (Select table_name
from information_schema.tables
where table_name= @table_name
) AliasName


change your...
Forum: MS SQL Nov 15th, 2008
Replies: 5
Views: 1,479
Posted By huangzhi
Use this command

select sum(Total) as [Amount]
from
(
select T1.Amount+T2.Amount as Total From TABLE1 T1 INNER TABLE2 T2 ON T1.ID = T2.ID
union all
select Amount as Total...
Forum: MS SQL Nov 13th, 2008
Replies: 5
Views: 1,479
Posted By huangzhi
select sum(Total)
from
(
select T1.Amount+T2.Amount as Total From TABLE1 T1 INNER TABLE2 T2 ON T1.ID = T2.ID
union all
select Amount as Total FROM TABLE3
) X
Forum: MS SQL Sep 6th, 2008
Replies: 8
Views: 2,571
Posted By huangzhi
Try this one:


select completed
from table
order by case when completed is null then 0 else 1 end, completed desc
Forum: MS SQL May 12th, 2008
Replies: 6
Views: 1,453
Posted By huangzhi
Try this code

select c.name, isNull(doc_A.Doc_A, 0) as Doc_A, isNull(doc_B.Doc_B, 0) as Doc_B, isNull(doc_C.Doc_C, 0) as Doc_C, isNull(doc_D.Doc_D, 0) as Doc_D
from tUsers u inner join...
Forum: MS SQL May 9th, 2008
Replies: 2
Views: 5,883
Posted By huangzhi
You cannot increase this limit. You must change your program. See http://www.daniweb.com/forums/thread114466.html. Hope this link can give you some idea.
Forum: MS SQL Apr 23rd, 2008
Replies: 2
Views: 8,006
Posted By huangzhi
update ABC
set XYZ = left(XYZ, 8) + 'A' + substring(XYZ, 9, 1000)
where XYZ like '%P' and XYZ not like '%A%'
Forum: MS SQL Apr 10th, 2008
Replies: 2
Views: 1,237
Posted By huangzhi
The correct code is:

select * from mail3 where email like '%+%' or email like '%*%'
Forum: MS SQL Apr 2nd, 2008
Replies: 2
Views: 2,831
Posted By huangzhi
Hope this code can help you.

1. Execute your first SP in query analyzer to show the columns list.

2. Create temporary table and the field must the same as first SP columns

create table...
Showing results 1 to 16 of 16

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC