Viewing 15 posts - 121 through 135 (of 178 total)
This will select the maximum value of prod, not the first!
I haven't got an elegant solution for this yet 🙁
Can anyone help?
-- this is OP's data/table
CREATE TABLE [dbo].[YTD_nni](
[Custn] [nvarchar](50) NULL,
[Prod]...
June 8, 2009 at 6:29 pm
Sorry, didn't fully read your last post, you want the first value, right?
gis a second, need to test this
June 8, 2009 at 5:48 pm
What value of prod do you want in the output? minimum, maximum etc?
Going by your earlier post max(convert(int,prod)) as prod would do the trick... so that means:
select
...
June 8, 2009 at 5:43 pm
Hi,
you need an aggregate function on each of the columns in your result set, I can't infer what the aggregate functions you need to apply to prod and pers, are...
June 8, 2009 at 5:20 pm
Am I missing something here, this query gives the median?
June 8, 2009 at 4:40 pm
You'll need to execute the query, check out objCmd.ExecuteScalar()
June 8, 2009 at 4:18 pm
Heh heh, solutions above are for removing whitespace in column names.
If you post some sample data, and table structure, you are much more likely to get a useful solution.
See http://www.sqlservercentral.com/articles/Best+Practices/61537/...
June 8, 2009 at 10:06 am
here's a possible solution, depends on what you mean by 'whitespace', I'm assuming space i.e. character 20.
create table #temptest ([some col] int, [some othercol] int)
select * from...
June 8, 2009 at 1:17 am
Nice one Michelle,
glad you got there, and no need for dynamic SQL!
Take care
Allister
June 2, 2009 at 1:09 am
The wildcard doesn't work at the beginning of search term, i.e. "*ci*" will not match "uncival".
Please correct this if I'm wrong!
May 30, 2009 at 9:04 am
change DECLARE @SQLSelectList VARCHAR(100) to DECLARE @SQLSelectList VARCHAR(max).
///edit
If you need more help with this you'll have to post a sample of data from temporary table #NormalNVP.
Check out Jeff's artice how...
May 30, 2009 at 3:32 am
Ok, then putting it all together:
select
CRM_PartsLabor.TRANSACTION_ID as [Service Order ID]
, CRM_PartsLabor.ORDERED_PROD as [Part No]
, CRM_PartsLabor.DESCRIPTION as [Part Desc]
, CRM_Confirmations.POSTING_DATE as [Date Consumed]
, CRM_StatusCodes.USER_STATUS as [Part Status]
, CRM_PartsLabor.QUANTITY as [Quantity]
, CRM_StatusCodes.END_DATE...
May 29, 2009 at 12:05 pm
yeah, it's putting the result into a temporary table, have a look at the following:
select
CRM_PartsLabor.TRANSACTION_ID as [Service Order ID]
, CRM_PartsLabor.ORDERED_PROD as [Part No]
, CRM_PartsLabor.DESCRIPTION as [Part Desc]
, CRM_Confirmations.POSTING_DATE as...
May 29, 2009 at 11:08 am
Sorry, got columns outta order:
CRM_PartsLabor.TRANSACTION_ID as [Service Order ID]
, CRM_PartsLabor.ORDERED_PROD as [Part No]
, CRM_PartsLabor.DESCRIPTION as [Part Desc]
, CRM_Confirmations.POSTING_DATE as [Date Consumed]
, CRM_StatusCodes.USER_STATUS as [Part Status]
, CRM_PartsLabor.QUANTITY as [Quantity]
, CRM_StatusCodes.END_DATE as...
May 29, 2009 at 10:59 am
OK, you are concatenating the two fields that you need separate for the required output: CRM_Partners.DESCRIPTION + ', ' + CRM_Partners.ADDRESS as [Role]... these need to be in two...
May 29, 2009 at 10:56 am
Viewing 15 posts - 121 through 135 (of 178 total)