unique

handling mysql constraint errors

Hi! I tried searching for a solution in this website but I can't seem to find any. I needed to find a way to know which field in my table is causing the constraint error.. In my table, say members table two fields (username,email) are unique keys and defined as unique keys apart from my primary key (memberid). When i add data to this t...

SQL: count of replica entries in a column

Simplistically I have a table that looks like this: ColA | ColB | -----+------+ EE34 | Woo | ER56 | fro | EE34 | eco | QW34 | Sddg | EE34 | zoo | ER56 | safe | I need a select statement for SQL Server that produces: ColA | Count | -----+-------+ EE34 | 3 | ER56 | 2 | QW34 | 1 | This could be running over a table wit...

setting up unique constraint on referenced collumns in oracle 10g xe

hi, i have the following situation. table looks like this CREATE TABLE CompetitionsLanguages ( competition REF CompetitionType SCOPE IS Competitions, language REF LanguageType SCOPE IS Languages ); i need this table to have a unique constraint on (competition,language) combination. oracle tells me that i cant put a UNIQUE or PK o...

Fluent-NHibernate: How to a create a many-to-many relationship with a unique contraint

Hi. I want to create a many to many relationship, but I want to have in the new table(MessageReceivers) a unique contraint on both columns (AdvanceMessageId,UserId): mapping.HasManyToMany(x => x.Receivers) .WithParentKeyColumn("AdvanceMessageId") .WithChildKeyColumn("UserId") .Cascade.All(...

Grails: String(username) as primary key, but save and get id string(username) with ignorecase?

I am using a string "username" as the primary-key of a table, But when saving and getting the column with the username id I want the case to be ignored so that new users can't try to impersonate another user. e.g. When registering a new user username = Daxon username = DaXoN //this should not be allowed When getting the unique user...

Unique value in StackTrace?

Background: I have written a generic logging library in .NET 3.5. Basically the developer needs to call the Begin() method at the beginning of their method and the End() method at the end of it. These methods do not take a parameter - the library uses the stacktrace to figure out where it came from. The library has a collection that k...

How to make a list of unique items from a column w/ repeats in PHP SQL

Say I have a table that has a column which goes Column B apple apple apple orange apple orange orange grapes grapes mango mango orange And I want to query it in such a way that I get a list like so apple orange grapes mango How do I do this in PHP SQL? Much thanks. ...

Bulk update & occasional insert (coredata) - Too slow

Update: Currently looking into NSSET's minusSet links: http://stackoverflow.com/questions/1475636/comparing-two-arrays Hi guys, Could benefit from your wisdom here.. I'm using Coredata in my app, on first launch I download a data file and insert over 500 objects (each with 60 attributes) - fast, no problem. Each subsequent launch I d...

Sql results into php array.

Hi, I would like to create an array (in php) from sql results like this: We have the sql-table "Posts" which stores the Name and the Message.Example: Name | Message John | Hello Nick | nice day George | Good bye John | where What i want is to output the names of people who have posted a message but dont display...

How to generate an unique computer id on Delphi?

Hello, How can I quickly generate an unique computer id for a delphi app? I used to do it easly with c#, but this failed sometimes. I do want the ID to be "static" but I don't care if the id changes because of a hardware change or OS reinstallation, I was planning to store it in the registry and check it when the app starts, and if it ch...

Unique model field in Django and case sensitivity (postgres)

Consider the following situation: - Suppose my app allows users to create the states / provinces in their country. Just for clarity, we are considering only ASCII characters here. In the US, a user could create the state called "Texas". If this app is being used internally, let's say the user doesn't care if it is spelled "texas" or "T...

XML Schema (XSD): How to express "At most one element from group A and at most one element from group b"?

Say I have two sets of XML elements: <One/> <Two/> <Three/> And <A/> <B/> <C/> And I want to have them as children of a bucket element: <Bucket> <A/> <One/> </Bucket> Or <Bucket> <C/> <Two/> </Bucket> But I don't want to allow more than one element from either set of elements. I.e: <Bucket> <A/> <B/> <On...

C# getting unique hash from all objects

Hi I want to be able to get a uniqe hash from all objects. What more, in case of Dictionary<string, MyObject> foo I want the unique keys for: string MyObject Properties in MyObject foo[someKey] foo etc.. object.GetHashCode() does not guarantee unique return values for different objects. That's what I need. Any idea? Thank y...

Select distinct + select top to merge multiple rows

I'm trying to select rows from a table, one row per email address, and return one firstname from the top row in the email list. The query, though, returns multiple email addresses. What am I doing wrong? SELECT DISTINCT email, (SELECT TOP 1 firstname FROM onsite_clients_archive oc WHERE oc.client_id=oca.client_id ...

unique() for arrays in javascript

As everybody knows there's no built-in function to remove the duplicates from an array in javascript. I've noticed this is also lacking in jQuery (which has a unique function for DOM selections only), and the most common snippet I found checks the entire array and a subset of it for each element (not very efficient I think), like: for (...

Xslt - Enforcing @attribute uniqueness.

I rarely work with xslt's so I'm not the greatest at it, but, I was wondering how to go about solving this problem: <Element> <childElement type="type1">Bob</childElement> <childElement type="type1">Smith</childElement> <childElement type="type2">Bob</childElement> </Element>" I want to enforce @type uniqueness, where I would...

trying to find duplicate usernames in ruby

hi i am trying to ensure that the username is unique when registering but im not sure how to do this I've tried: validates_uniqueness_of :username but it doesnt work it gives me this error: undefined method 'validates_uniqueness_of' for #<UsersController:0x6c4fd2> Any help please? ...

Simple number pattern to store combinations as a unique sum

This is a math problem, but I'm sure this must come up in some programming scenarios, at least I hope so, and I was wondering if there was a name for this type of situation: Suppose I have 7 items in a series. For the sake of this example, let's use days of the week. I would like a user to submit which days of the week they plan to come...

mysql select unique records

I've got the following query: select * from members,subscriptions where members.MemberID = subscriptions.MemberID and subscriptions.Year = 2009 and members.ASSCID = 15 and subscriptions.Untildate between '$2009-01-01' and '2009-12-31' order by members.Memberlastname Members pay either their annual subscription once (annual subscription...

Excel: Putting together two different complex formulas (Unique distinct list & Split)

Hello all you amazing people I wanted to do two things populate a unique distinct list from a long list of repetitive values extract component of a text delimited with hyphen I found solutions to each one of these problems at different places. Unique distinct list here: http://www.get-digital-help.com/2009/03/30/how-to-extract-a-un...