Showing posts with label cant. Show all posts
Showing posts with label cant. Show all posts

Thursday, March 22, 2012

DISTINCT doesnt seem to be working

Hi all,

I am using SQLEXPRESS 2005 and can't figure out why my SQL query is not working.

Select DISTINCT ads.clientid, ads.ad, ads.adid, ads.cost, ads.description, ads.bold, ads.info, ads.contact, ads.coupon, ads.logo, ads.map, ads.webpage, ads.weburl, tclients.clientname, tclients.clientphone, tclients.addNumber, tclients.addStreet, tclients.addsuite, tclients.addcity, tclients.addstate, tclients.addzipfrom tclients, adswhere tclients.clientid=ads.clientidAND AdActive=1ORDER BY COSTDESC

I expect only one row to be returned for each ads.clientid. However, every single record that matches the query is being returned, which results in multiple records with the same clientid.

This happens if it isads.clientid ortclients.clientid.

Martin

DISTINCT returns unique rows based on all columns in the query, not just the first column (clientid) that you've specified.|||

Ah - I'm glad it it working as intended and I am not going mad...

How would I go about getting what I wanted then? Just one clientid.

|||

Can't answer that.

You said what you wanted.

You showed the query you have and the columns that you want.

The two don't mix, or the distinct would have worked anyhow. You obviously have multiple records with the same clientid, and differing data. WHICH of the differing data would you like when a clientid has multiple?

Assuming your fingers have names (index,middle,ring,pinky,thumb), and your hands have names (left, right).

Please tell me the length of your finger on each hand. And I only want one 2 entries, one for each hand. And if you are left scratching your head, it's because the question doesn't match the data, and you can't answer it. If I said, tell me the length of the longest finger on each hand, NOW you can answer, or I could say tell me the length of your index finger on each hand, etc.

|||

Thanks for that post - it helped me realize what I am doing wrong in my query.

I assumed because I was ordering by COST that it would take the first record for each clientid. In your example, it would order all my fingers by length, then take the longest one from each hand.

Since I know this is not the case, I know have to figure out how to re-write the query.

|||

Motley,

This SEEMS to work, but I'm not a SQL expert, so I can't be sure it will in real data. Does it look good to you? The bolded part is what I added.

Select DISTINCT ads.clientid, ads.ad, ads.adid, ads.cost, ads.description, ads.bold, ads.info, ads.contact, ads.coupon, ads.logo, ads.map, ads.webpage, ads.weburl, tclients.clientname, tclients.clientphone, tclients.addNumber, tclients.addStreet, tclients.addsuite, tclients.addcity, tclients.addstate, tclients.addzipfrom tclients, adswhere tclients.clientid=ads.clientidAND AdActive=1AND costin (select max(ads.cost)from adsgroup by clientid)ORDER BY COSTDESC

Sunday, February 19, 2012

display properties

hi, i cant seen to change my color settings or the size of
my desktop. i dont know what my driver is and i have tried
installing others out of the list given on the win98 disk
and it isnt working, can somebody please help me out
because i cant view anyting in a higher resolution and i
cant access any programs, thanks.
This is a SQL Server newsgroup and has absolutely nothing to do with Windows
98 display problems. How about trying
microsoft.public.win98.display.general?
Good luck!
Stephen Dybing
This posting is provided "AS IS" with no warranties, and confers no rights.
"mike" <mickmckenna2003@.aol.com> wrote in message
news:126d801c442a9$8f43fbc0$a501280a@.phx.gbl...
> hi, i cant seen to change my color settings or the size of
> my desktop. i dont know what my driver is and i have tried
> installing others out of the list given on the win98 disk
> and it isnt working, can somebody please help me out
> because i cant view anyting in a higher resolution and i
> cant access any programs, thanks.

Tuesday, February 14, 2012

display error

in the report desingner textbox cant display the value like this. what is the error. those are multivalues.

=CStr(Parameters!BU.Value)

A mutli-valued parameter is represented as an array of values, so if you want the first value:

=CStr(Parameters!BU.Value(0))|||result is [acc code].[bu].&[1] but i need to get the real value like bu1, bu2 etc:
|||

From the sounds of it you are using reporting services - If so I think you need to use:

Parameters!BU.Label

No need fo cstr either

HTH

|||that give some error.
|||

How about:

Parameters!BU.Label(0)

|||found the answer: JOIN(Parameters!BU.Label,",")

Display Data in Particular Format

I want to display in following manner.i tried a lot with Matrix with celing function but i can't achieve it.

My Crieteria:

I Used to Develop An attendence Register for employees.Each Employees have Multiple Login and Logout.

NwMy Issue is I want to Group Each Employees with having his own IN andOut on a particular day he Present.And at the same time since eachemployees having several login and logout for a particular day.I wantto Wrap a matrix after certain columns and display the rest in nextline for that day of that employee

ie,

i Want in this format

Employee Name: E1

Present Day 1

IN1 OUT1 IN2 OUT2 IN3 OUT3........after a particular column it should be wrapped and displayed in next line

IN4 Out4 IN5 OUT5............this process is continued until all the login and Logouts of tht employees is displayed...

Then

Present Day2

INs and Outs

Present Day3

INs and Outs

After The first Employees

Similar Format is For all the other employees

How can i achieve this??


Could you be more specific? Say, where are your data? in SQL Server?

You can use, for example, nested datalist's, with the nested DataList configured with the columns you want to display, is very easy and there are a lot of tutorials, but I don't know exactly where are your data and where do you want to display that information.

Another way is to retrieve it in XML and render with a XSLT stylesheet. Is quite more complex but gives you more flexibility.

Here's a tutorial with nested repeaters, but the philosophy with datalists is the same.
http://www.aspnettutorials.com/tutorials/controls/nested-repeater-vb.aspx