Search Results

Search found 10930 results on 438 pages for 'self signed'.

Page 34/438 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • Many to many self join through junction table

    - by Peter
    I have an EF model that can self-reference through an intermediary class to define a parent/child relationship. I know how to do a pure many-to-many relationship using the Map command, but for some reason going through this intermediary class is causing problems with my mappings. The intermediary class provides additional properties for the relationship. See the classes, modelBinder logic and error below: public class Equipment { [Key] public int EquipmentId { get; set; } public virtual List<ChildRecord> Parents { get; set; } public virtual List<ChildRecord> Children { get; set; } } public class ChildRecord { [Key] public int ChildId { get; set; } [Required] public int Quantity { get; set; } [Required] public Equipment Parent { get; set; } [Required] public Equipment Child { get; set; } } I've tried building the mappings in both directions, though I only keep one set in at a time: modelBuilder.Entity<ChildRecord>() .HasRequired(x => x.Parent) .WithMany(x => x.Children ) .WillCascadeOnDelete(false); modelBuilder.Entity<ChildRecord>() .HasRequired(x => x.Child) .WithMany(x => x.Parents) .WillCascadeOnDelete(false); OR modelBuilder.Entity<Equipment>() .HasMany(x => x.Parents) .WithRequired(x => x.Child) .WillCascadeOnDelete(false); modelBuilder.Entity<Equipment>() .HasMany(x => x.Children) .WithRequired(x => x.Parent) .WillCascadeOnDelete(false); Regardless of which set I use, I get the error: The foreign key component 'Child' is not a declared property on type 'ChildRecord'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property. when I try do deploy my ef model to the database. If I build it without the modelBinder logic in place then I get two ID columns for Child and two ID columns for Parent in my ChildRecord table. This makes sense since it tries to auto create the navigation properties from Equipment and doesn't know that there are already properties in ChildRecord to fulfill this need. I tried using Data Annotations on the class, and no modelBuilder code, this failed with the same error as above: [Required] [ForeignKey("EquipmentId")] public Equipment Parent { get; set; } [Required] [ForeignKey("EquipmentId")] public Equipment Child { get; set; } AND [InverseProperty("Child")] public virtual List<ChildRecord> Parents { get; set; } [InverseProperty("Parent")] public virtual List<ChildRecord> Children { get; set; } I've looked at various other answers around the internet/SO, and the common difference seems to be that I am self joining where as all the answers I can find are for two different types. Entity Framework Code First Many to Many Setup For Existing Tables Many to many relationship with junction table in Entity Framework? Creating many to many junction table in Entity Framework

    Read the article

  • Python PyQt Timer Firmata

    - by George Cullins
    Hello. I am pretty new to python and working with firmata I am trying to play around with an arduino . Here is what I want to happen: Set arduino up with an LED as a digital out Set potentiometer to analog 0 Set PyQt timer up to update potentiometer position in application Set a threshold in PyQt to turn LED on (Analog in has 1024bit resolution, so say 800 as the threshold) I am using this firmata library : Link Here is the code that I am having trouble with: import sys from PyQt4 import QtCore, QtGui from firmata import * # Arduino setup self.a = Arduino('COM3') self.a.pin_mode(13, firmata.OUTPUT) # Create timer self.appTimer = QtCore.QTimer(self) self.appTimer.start(100) self.appTimer.event(self.updateAppTimer()) def updateAppTimer(self): self.analogPosition = self.a.analog_read(self, 0) self.ui.lblPositionValue.setNum() I am getting the error message: Traceback (most recent call last): File "D:\Programming\Eclipse\IO Demo\src\control.py", line 138, in myapp = MainWindow() File "D:\Programming\Eclipse\IO Demo\src\control.py", line 56, in init self.appTimer.event(self.updateAppTimer()) File "D:\Programming\Eclipse\IO Demo\src\control.py", line 60, in updateAppTimer self.analogPosition = self.a.analog_read(self, 0) TypeError: analog_read() takes exactly 2 arguments (3 given) If I take 'self' out I get the same error message but that only 1 argument is given What is python doing implicitly that I am not aware of? Blockquote

    Read the article

  • python: how to design a container with elements that must reference their container

    - by Luke404
    (the title is admittedly not that great. Please forgive my English, this is the best I could think of) I'm writing a python script that will manage email domains and their accounts, and I'm also a newby at OOP design. My two (related?) issues are: the Domain class must do special work to add and remove accounts, like adding/removing them to the underlying implementation how to manage operations on accounts that must go through their container To solve the former issue I'd add a factory method to the Domain class that'll build an Account instance in that domain, and a 'remove' (anti-factory?) method to handle deletions. For the latter this seems to me "anti-oop" since what would logically be an operation on an Account (eg, change password) must always reference the containing Domain. Seems to me that I must add to the Account a reference back to the Domain and use that to get data (like the domain name) or call methods on the Domain class. Code example (element uses data from the container) that manages an underlying Vpopmail system: class Account: def __init__(self, name, password, domain): self.name = name self.password = password self.domain = domain def set_password(self, password): os.system('vpasswd %s@%s %s' % (self.name, self.domain.name, password) self.password = password class Domain: def __init__(self, domain_name): self.name = domain_name self.accounts = {} def create_account(self, name, password): os.system('vadduser %s@%s %s' % (name, self.name, password)) account = Account(name, password, self) self.accounts[name] = account def delete_account(self, name): os.system('vdeluser %s@%s' % (name, self.name)) del self.accounts[name] another option would be for Account.set_password to call a Domain method that would do the actual work - sounds equally ugly to me. Also note the duplication of data (account name also as dict key), it sounds logical (account names are "primary key" inside a domain) but accounts need to know their own name.

    Read the article

  • Django tests failing on invalid keyword argument

    - by Darwin Tech
    I have a models.py like so: from django.db import models from django.contrib.auth.models import User from datetime import datetime class UserProfile(models.Model): user = models.OneToOneField(User) def __unicode__(self): return self.user.username class Project(models.Model): user = models.ForeignKey(UserProfile) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) product = models.ForeignKey('tool.product') module = models.ForeignKey('tool.module') model = models.ForeignKey('tool.model') zipcode = models.IntegerField(max_length=5) def __unicode__(self): return unicode(self.id) And my tests.py: from django.test import TestCase, Client # --- import app models from django.contrib.auth.models import User from tool.models import Module, Model, Product from user_profile.models import Project, UserProfile # --- unit tests --- # class UserProjectTests(TestCase): fixtures = ['admin_user.json'] def setUp(self): self.product1 = Product.objects.create( name='bar', ) self.module1 = Module.objects.create( name='foo', enable=True ) self.model1 = Model.objects.create( module=self.module1, name='baz', enable=True ) self.user1 = User.objects.get(pk=1) ... def test_can_create_project(self): self.project1 = Model.objects.create( user=self.user1, product=self.product1, module=self.module1, model=self.model1, zipcode=90210 ) self.assertEquals(self.project1.zipcode, 90210) But I get a TypeError: 'product' is an invalid keyword argument for this function error. I'm not sure what is failing but I'm guessing something to do with the FK relationships... Any help would be much appreciated.

    Read the article

  • python can't start a new thread

    - by Giorgos Komnino
    I am building a multi threading application. I have setup a threadPool. [ A Queue of size N and N Workers that get data from the queue] When all tasks are done I use tasks.join() where tasks is the queue . The application seems to run smoothly until suddently at some point (after 20 minutes in example) it terminates with the error thread.error: can't start new thread Any ideas? Edit: The threads are daemon Threads and the code is like: while True: t0 = time.time() keyword_statuses = DBSession.query(KeywordStatus).filter(KeywordStatus.status==0).options(joinedload(KeywordStatus.keyword)).with_lockmode("update").limit(100) if keyword_statuses.count() == 0: DBSession.commit() break for kw_status in keyword_statuses: kw_status.status = 1 DBSession.commit() t0 = time.time() w = SWorker(threads_no=32, network_server='http://192.168.1.242:8180/', keywords=keyword_statuses, cities=cities, saver=MySqlRawSave(DBSession), loglevel='debug') w.work() print 'finished' When the daemon threads are killed? When the application finishes or when the work() finishes? Look at the thread pool and the worker (it's from a recipe ) from Queue import Queue from threading import Thread, Event, current_thread import time event = Event() class Worker(Thread): """Thread executing tasks from a given tasks queue""" def __init__(self, tasks): Thread.__init__(self) self.tasks = tasks self.daemon = True self.start() def run(self): '''Start processing tasks from the queue''' while True: event.wait() #time.sleep(0.1) try: func, args, callback = self.tasks.get() except Exception, e: print str(e) return else: if callback is None: func(args) else: callback(func(args)) self.tasks.task_done() class ThreadPool: """Pool of threads consuming tasks from a queue""" def __init__(self, num_threads): self.tasks = Queue(num_threads) for _ in range(num_threads): Worker(self.tasks) def add_task(self, func, args=None, callback=None): ''''Add a task to the queue''' self.tasks.put((func, args, callback)) def wait_completion(self): '''Wait for completion of all the tasks in the queue''' self.tasks.join() def broadcast_block_event(self): '''blocks running threads''' event.clear() def broadcast_unblock_event(self): '''unblocks running threads''' event.set() def get_event(self): '''returns the event object''' return event

    Read the article

  • python gui events out of order

    - by dave
    from Tkinter import * from tkMessageBox import * class Gui: def __init__(self, root): self.container = Frame(root) self.container.grid() self.inputText = Text(self.container, width=50, height=8) self.outputText = Text(self.container, width=50, height=8, bg='#E0E0E0', state=DISABLED) self.inputText.grid(row=0, column=0) self.outputText.grid(row=0, column=1) self.inputText.bind("<Key>", self.translate) def translate(self, event): input = self.inputText.get(0.0, END) output = self.outputText.get(0.0, END) self.outputText.config(state=NORMAL) self.outputText.delete(0.0, END) self.outputText.insert(INSERT, input) self.outputText.config(state=DISABLED) showinfo(message="Input: %s characters\nOutput: %s characters" % (len(input), len(input))) root = Tk() #toplevel object app = Gui(root) #call to the class where gui is defined root.mainloop() #enter event loop Working on a gui in tkinter I'm a little confused as to the sequence the event handlers are run. If you run the above code you'll hopefully see... 1) Editing the text widget triggers the event handler but it seems to fire it off without registering the actual change, 2) Even when the text widget is cleared (ie, keep pressing BackSpace) it still seems to have a one character length string, 3) The output widget only receives its update when the NEXT event trigger is fired despite the fact the data came on the previous event. Is this just how bindings work in tkinter or am i missing something here? The behaviour i would like when updating the input widget is: 1) Show the change, 2) Enter event handler, 3) Update output widget, 4) Show message box.

    Read the article

  • PGU HTML Renderer can't render most sites

    - by None
    I am trying to make a web browser using pygame. I am using PGU for html rendering. It works fine when I visit simple sites, like example.com, but when I try and load anything more complex that uses an html form, like google, I get this error: UnboundLocalError: local variable 'e' referenced before assignment I looked in the PGU html rendering file and found this code segment: def start_input(self,attrs): r = self.attrs_to_map(attrs) params = self.map_to_params(r) #why bother #params = {} type_,name,value = r.get('type','text'),r.get('name',None),r.get('value',None) f = self.form if type_ == 'text': e = gui.Input(**params) self.map_to_connects(e,r) self.item.add(e) elif type_ == 'radio': if name not in f.groups: f.groups[name] = gui.Group(name=name) g = f.groups[name] del params['name'] e = gui.Radio(group=g,**params) self.map_to_connects(e,r) self.item.add(e) if 'checked' in r: g.value = value elif type_ == 'checkbox': if name not in f.groups: f.groups[name] = gui.Group(name=name) g = f.groups[name] del params['name'] e = gui.Checkbox(group=g,**params) self.map_to_connects(e,r) self.item.add(e) if 'checked' in r: g.value = value elif type_ == 'button': e = gui.Button(**params) self.map_to_connects(e,r) self.item.add(e) elif type_ == 'submit': e = gui.Button(**params) self.map_to_connects(e,r) self.item.add(e) elif type_ == 'file': e = gui.Input(**params) self.map_to_connects(e,r) self.item.add(e) b = gui.Button(value='Browse...') self.item.add(b) def _browse(value): d = gui.FileDialog(); d.connect(gui.CHANGE,gui.action_setvalue,(d,e)) d.open(); b.connect(gui.CLICK,_browse,None) self._locals[r.get('id',None)] = e I got the error in the last line, because e wasn't defined. I am guessing the reason for this is that the if statement that checks the type of the input and creates the e variable didn't match anything. I added a line to print the _type variable and I got 'hidden' when i tried google and apple. Is there any way to render form items that have the type 'hidden' with PGU?

    Read the article

  • Python list recursion type error

    - by Jacob J Callahan
    I can't seem to figure out why the following code is giving me a TypeError: 'type' object is not iterable pastebin: http://pastebin.com/VFZYY4v0 def genList(self): #recursively generates a sorted list of child node values numList = [] if self.leftChild != 'none': numList.extend(self.leftChild.genList()) #error numList.extend(list((self.Value,))) if self.rightChild != 'none': numList.extend(self.rightChild.genList()) #error return numList code that adds child nodes (works correctly) def addChild(self, child): #add a child node. working if child.Value < self.Value: if self.leftChild == 'none': self.leftChild = child child.parent = self else: self.leftChild.addChild(child) elif child.Value > self.Value: if self.rightChild == 'none': self.rightChild = child child.parent = self else: self.rightChild.addChild(child) Any help would be appreciated. Full interpreter session: >>> import BinTreeNode as BTN >>> node1 = BTN.BinaryTreeNode(5) >>> node2 = BTN.BinaryTreeNode(2) >>> node3 = BTN.BinaryTreeNode(12) >>> node3 = BTN.BinaryTreeNode(16) >>> node4 = BTN.BinaryTreeNode(4) >>> node5 = BTN.BinaryTreeNode(13) >>> node1.addChild(node2) >>> node1.addChild(node3) >>> node1.addChild(node4) >>> node1.addChild(node5) >>> node4.genList() <class 'list'> >>> node1.genList() Traceback (most recent call last): File "<interactive input>", line 1, in <module> File "C:...\python\BinTreeNode.py", line 47, in genList numList.extend(self.leftChild.genList()) #error File "C:...\python\BinTreeNode.py", line 52, in genList TypeError: 'type' object is not iterable

    Read the article

  • On-Demand Python Thread Start/Join Freezing Up from wxPython GUI

    - by HokieTux
    I'm attempting to build a very simple wxPython GUI that monitors and displays external data. There is a button that turns the monitoring on/off. When monitoring is turned on, the GUI updates a couple of wx StaticLabels with real-time data. When monitoring is turned off, the GUI idles. The way I tried to build it was with a fairly simple Python Thread layout. When the 'Start Monitoring' button is clicked, the program spawns a thread that updates the labels with real-time information. When the 'Stop Monitoring' button is clicked, thread.join() is called, and it should stop. The start function works and the real-time data updating works great, but when I click 'Stop', the whole program freezes. I'm running this on Windows 7 64-bit, so I get the usual "This Program has Stopped Responding" Windows dialog. Here is the relevant code: class MonGUI(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) ... ... other code for the GUI here ... ... # Create the thread that will update the VFO information self.monThread = Thread(None, target=self.monThreadWork) self.monThread.daemon = True self.runThread = False def monThreadWork(self): while self.runThread: ... ... Update the StaticLabels with info ... (This part working) ... # Turn monitoring on/off when the button is pressed. def OnClick(self, event): if self.isMonitoring: self.button.SetLabel("Start Monitoring") self.isMonitoring = False self.runThread = False self.monThread.join() else: self.button.SetLabel("Stop Monitoring") self.isMonitoring = True # Start the monitor thread! self.runThread = True self.monThread.start() I'm sure there is a better way to do this, but I'm fairly new to GUI programming and Python threads, and this was the first thing I came up with. So, why does clicking the button to stop the thread make the whole thing freeze up?

    Read the article

  • self.view.frame.size in viewDidLoad and didRotateFromInterfaceOrientation are different

    - by tokentoken
    I created iphone view-based project, and added UINavigationController by code. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { TestViewController *vc = [[TestViewController alloc]init]; navController = [[UINavigationController alloc]initWithRootViewController:vc]; [window addSubview:navController.view]; [window makeKeyAndVisible]; return YES; } After that, I checked self.view.frame.size.height in viewDidLoad and didRotateFromInterfaceOrientation, and they're different. (they're 460 and 416) I suppose the height of NavigationBar is not included in viewDidLoad, but should I add it manually (add 44)?

    Read the article

  • window.focus(), self.focus() not working in firefox

    - by Nisanth
    Hi all i am developing a chat application ... i have multiple chat windows ... i want to know which windw contain new message ... i have the following code .. function getCount() { $.ajax({ type: "POST", url: baseUrl + '/Chat/count', data: "chat_id=" + document.ajax.chat_id.value, success: function(msg){ if(msg == 'new1') { self.focus(); //window.focus(); } } }); } If an operator attending both chat.... for example the url is like http://localhost/nisanth/admin/Chat/index/chatId/15 http://localhost/nisanth/admin/Chat/index/chatId/16 http://localhost/nisanth/user/Chat/index/chatId/15 http://localhost/nisanth/user/Chat/index/chatId/16 if the user 16 enter a message i need focus http://localhost/nisanth/admin/Chat/index/chatId/16 This code is work fine with IE but not in firefox...please give me a solution... the above code is in the same html

    Read the article

  • Getting hierarchy data from a self-referencing table

    - by Emanuil
    Let's say you have the following table: items(item_id, item_parent) ... and it is a self-referencing table as item_parent refers to item_id. What SQL query would you use to SELECT all items in the table along with their depth where the depth of an item is the sum of all parents and grand parents of that item. If the following is the content of the table: item_id item_parent ----------- ----------- 1 0 2 0 3 2 4 2 5 3 ... the query should retrieve the following set of objects: {"item_id":1,"depth":0} {"item_id":2,"depth":0} {"item_id":3,"depth":1} {"item_id":4,"depth":1} {"item_id":5,"depth":2} P.S. I'm looking for a MySQL supported approach.

    Read the article

  • Drupal - no self-linking

    - by pygorex1
    So, I've added several pages to my Drupal install and linking to the pages using URL aliases via the Path module. So far so good - http://mydrupal/node/1 becomes http://mydrupal/about which is exactly what I'm looking for. Then I'm adding these links to the primary navigation and outputting the primary links via a custom theme (copy and paste the primary link code from the Chameleon theme). Here's the problem: when viewing http://mydrupal/about the page links to itself - that is the "About" link at http://mydrupal/about is still linking to http://mydrupal/about - the behavior I'm looking for is to have the "About" text display without a link. In summary: how do I prevent self-linking of pages when displaying the primary navigation?

    Read the article

  • Right way to create [self]respawning app in python

    - by grapescan
    I am using jabber bot written in python to log some MUC talks. Sometimes it drops on some network or XMPP problems. In this case I have to start it again by myself. The goal is to make it "self-respawning". I have some variants about how to do it. Bot is one process. Another process monitors its activity and starts it if bot died. Main process spawns bot subprocess and controls it. Also I think daemonizing bot process is useful here. Platform is Linux, as you could guess. What is the right way to solve this problem?

    Read the article

  • how could i make working self-hosted openid provider, connected to wordpress

    - by blog.blomqvist.no
    Aim: To have own OpenId provider connected with self-hosted Wordpress blog, so Wordpress admin could use his OpenId to login to Admin Panel, and also to comment other blogs with this OpenId. Blog address: http://blog.blomqvist.no OpenId provider: /id/ OpenId created: same as blog address WP Plugins used: WP-Yadis 1.2.1 XRDS-Simple 1.0 OpenId 3.3.2 I have installed phpMyId as OpenId provider. I have managed to connect created OpenId and management panel login, so Admin could login to management panel with created OpenId. However, i can't use this OpenId anywhere else, not on blogspot, not on other wordpress blogs etc.

    Read the article

  • Self-extracting Delphi program

    - by Steve
    I'm writing an updater program in Delphi7 which will be run once, but needs many files to run. What I'd like the achieve: 1, User runs exe 2, Exe unpacks files, runs updater 3, If updater detects and error, prompts the user to send log in e-mail 4, After the updater is run, temporary files are deleted (some of these files are dlls used by the updater program, so the updater has to be closed before the files can be deleted) Can anyone recommend a good solution? I've thought about using Inno Setup (too complicated for such an easy task) or using a self-extracting zip file (but how to delete the files afterwards)? Thanks!

    Read the article

  • jQuery: Self Executing Plugin?

    - by GnrlBzik
    I am working on expansion of my jQuery plug-in authoring knowledge, just playing around with my own ideas for learning benefits. So i was wondering how you guys tackle the need of plugin executing without any user specific input. So I have a need for plug-in that executes right away after document is ready, without any user's specific input just as long as doc is loaded, so the only way I see how to execute plug-in on it's own is to attach handler to ready listener that executes my function which I extended the jQuery with. And because this needs to be self enclosed, part of the code, I attach handler to event listener within the function. So how else could one tackle this? Any take at this is appreciated. Thank you in advance everyone.

    Read the article

  • Self hosted WCF console output from service

    - by user989056
    quick one: Is it possible to capture the output stream of a WCF service that is hosted via ServiceHost ( self hosted service) ? I have methods within my WCF service that output useful debugging information, is it possible to send these to it's host's console output? Edit: It appears that I have made an obvious blunder - I was using Debug instead of Console. It is possible to output to the console by using the standard Console output commands in your WCF service class. I have marked the answer that I have found the most useful.

    Read the article

  • Self Executing jQuery Plugin?

    - by GnrlBzik
    I am working on expansion of my jQuery plug-in authoring knowledge, just playing around with my own ideas for learning benefits. So i was wondering how you guys tackle the need of plugin executing without any user specific input. So I have a need for plug-in that executes right away after document is ready, without any user's specific input just as long as doc is loaded, so the only way I see how to execute plug-in on it's own is to attach handler to ready listener that executes my function which I extended the jQuery with. And because this needs to be self enclosed, part of the code, I attach handler to event listener within the function. So how else could one tackle this? Any take at this is appreciated. Thank you in advance everyone.

    Read the article

  • Making self-logging modules with Log::Log4perl

    - by Oesor
    Is there a way to use Log::Log4perl to make a smart self-logging module that logs its operations to a file even in the absence of the calling script not initializing Log4perl? As far as I can tell from the documentation, the only way to use Log4perl is to initialize it in the running script from a configuration, then modules implementing Log4perl calls log themselves based on the caller's Log4perl config. Instead, I'd like the modules to provide a default initialization config for Log4perl. This would provide the default file appender for the module's category. Then, I could override this behavior by initing Log4perl in the caller with a different config if needed, and everything would hopefully just work. Is this sort of defensive logging behavior possible or am I going to need to rely on initing Log4perl in every .pl script that calls the module I want logged?

    Read the article

  • databinding to self without code

    - by jcollum
    I'm building a UserControl in WPF. The control has two properties, Title and Description, that I'd like to bind to two textblocks. Seems real straightforward, and I got it working, but I'm curious about something. To get it to work I had to add this code: void CommandBlock_Loaded(object sender, RoutedEventArgs e) { this.DataContext = this; } My bindings look like this: <TextBlock Text="{Binding Title}" Width="100" ... /> <TextBlock Text="{Binding Description}" Width="100" ... /> What I'm wondering is how come I couldn't get it to work without the this.DataContext = this; and instead use DataContext="{Binding RelativeSource={RelativeSource Self}}" (in the UserControl element of the markup)? I'm sure I'm missing something about DataContexts but don't know what.

    Read the article

  • iPad --- managedObject problem when [self.tableViewSection reloadData]

    - by user345777
    Hi , I am creating a news aggregator application that fetches a xml feed every 4 minutes. After the xml is loaded, I clear everything by deleting all the objects in the database, then save the new objects back into the database. I then call [self.tableViewSection reloadData]; to reload the tableView. Thats when I get a problem. As soon as the code gets to a section where i access the new [[managedObject valueForKey:@"event_text"] description] content it fails with a : * Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0x4b3f6a0 '' Now from the flow I described on top, it seems odd to me that the tableView is populated properly the next time i launch the application, with the "new" data I fetched in the previous session. So its not that data thats corrupt , but seems to me something goes wrong when I refetch the managedObject after saving new data. Also keep in mind thats this app runs fine on the iPhone, its the iPad thats is giving me this problem.

    Read the article

  • T-SQL Self Join in combination with aggregate function

    - by Nick
    Hi, i have the following table. CREATE TABLE [dbo].[Tree]( [AutoID] [int] IDENTITY(1,1) NOT NULL, [Category] [varchar](10) NULL, [Condition] [varchar](10) NULL, [Description] [varchar](50) NULL, CONSTRAINT [PK_Tree] PRIMARY KEY CLUSTERED ( [AutoID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO the data looks like this: INSERT INTO [Test].[dbo].[Tree] ([Category] ,[Condition] ,[Description]) VALUES ('1','Alpha','Type 1') INSERT INTO [Test].[dbo].[Tree] ([Category] ,[Condition] ,[Description]) VALUES ('1','Alpha','Type 1') INSERT INTO [Test].[dbo].[Tree] ([Category] ,[Condition] ,[Description]) VALUES ('2','Alpha','Type 2') INSERT INTO [Test].[dbo].[Tree] ([Category] ,[Condition] ,[Description]) VALUES ('2','Alpha','Type 2') go I try now to do the following: SELECT Category,COUNT(*) as CategoryCount FROM Tree where Condition = 'Alpha' group by Category but i wish also to get the Description for each Element. I tried several subqueries, self joins etc. i always come to the problem that the subquery cannot return more than one record. The problem is caused by a poor database design which i cannot change and i run out of ideas to get this done in a single query ;-(

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >