Skip to content

Tag: sql

LINQ to SQL, select from an inheritted class

Using LINQ to SQL and Object Relational Designing; Let’s say we have a class Animal with two inherited classes, named Cat and Dog. We can load the “Animal” class and its properties easily: However, when trying to load Cat or Dog, dataContext has the attribute of neither Cats nor Dogs. How is…

SQL select multiple max rows where ID is same

i’ve struggled again and again on this, but can’t get it to work. been on these forums for hours now… Data set: Row Date AccountID Column 1 1 21/02/2013 0:30 A0M8FA1003YP . 2 21/02/2013 0:30 A0M8FA1003YP . 3 21/02/2013 0:30 A0M8FA1003YP . 4 24/09/2007 12:00 A0M8FA1003YP . 5 24/09/2007 12:00 …

Indexing distinct values for a column

I have a table containing a column authors that contains names of authors for different articles (different rows). I want to add a new column that contains a unique index for every author,i.e. let’s say 12 for every occurrence of Dickens (just a random pick) in the author column. Can it be done by a MyS…

python – how to check if table exists?

I’m using this function : def checker(name,s) MY_T = “SELECT count(*) FROM `”+session.SessionInfo.Name where EventName=’”+name+”‘” I want to check if the table exists, how can I do it ? I …

Select row with most recent date per user

I have a table (“lms_attendance”) of users’ check-in and out times that looks like this: I’m trying to create a view of this table that would output only the most recent record per user id, while giving me the “in” or “out” value, so something like: I’m pr…

Formatting bigdecimals sql oracle

To have a readable big numbers under oracle and to facilatet the reading, I’m looking for a way to add blank space to obtain something like that: 213537592384.236 ===> 213 537 592 384.236 The problem that I have big numbers like above. Answer Spaces are a curious separator, and not directly supported…