SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Constant value in a query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Vadz
Starting Member

Fiji
11 Posts

Posted - 11/14/2012 :  18:14:50  Show Profile  Reply with Quote
how to declare a constant value in a query?
select a(h.test_id) as Cat,
i.Id as dogid,
i.Capacity as total,
i.office as Company,

group by i.id.

i want to maki.Capacity as total(300) and i.office as Company(400)as my different constant value..

thanks in advance

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 11/14/2012 :  19:46:08  Show Profile  Reply with Quote
The syntax of what you have posted does not seem to be correct. Is "a(h.test_id)" invoking a UDF named "a"? If so it needs to be prefixed with the schema name. In any case, is something like this what you are looking for?
select h.test_id as Cat,
  i.Id as dogid,
  i.Capacity as total,
  i.office as Company,
  300 as Capacity,
  400 as Company

Edited by - sunitabeck on 11/14/2012 19:46:39
Go to Top of Page

Vadz
Starting Member

Fiji
11 Posts

Posted - 11/14/2012 :  20:51:37  Show Profile  Reply with Quote
thanks for your reply.

Query runs fine now now so my output look like this

company Capacity type
300 400 Toyota
300 400 Toyota
300 400 Hyundai
300 400 Hyundai
300 400 Nissan

so i want to be display like this in a unique value the the 1 below

company Capacity type
400 Toyota
400 Toyota
300 Hyundai
300 Hyundai
300 Nissan

400 should assigned only to Toyota and 300 only too Hyundai and Nissan

thanks for your patient in reading ..
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 11/15/2012 :  10:42:47  Show Profile  Reply with Quote
so what about other types? are there only these 3 always?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Vadz
Starting Member

Fiji
11 Posts

Posted - 11/15/2012 :  15:40:48  Show Profile  Reply with Quote
there are only 3 types...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 11/15/2012 :  23:55:54  Show Profile  Reply with Quote
quote:
Originally posted by Vadz

there are only 3 types...



I dont understand your output. you have three columns but i can see only 2 set of values. post outpt within code tags to show us correct alignment

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000