query

Meaning of (+) in SQL queries

I've come across some SQL queries in Oracle that contain '(+)' and I have no idea what that means. Can someone explain its purpose or provide some examples of its use? Thanks ...

SQL List Function Removing Precision

I am using the LIST function to create a ';' delimited list of values. The type is numeric (19,2). For some reason the precision appears to be ignored when using the list function. When performing a simple select on this column the values look good, ie "12.00". However, if I use a LIST() my results are of format "12.000000" This is my L...

MySql : UNION is not getting executed when executed as a view

0 vote down star Hi, I am trying to create a view for a UNION of 2 select statements that I have created. The UNION is working fine when executed individually But the problem is only the 1st part of the UNION is getting executed when I am executing it as a view. The query I am using is as below SELECT DISTINCT products.pid AS id, ...

In SQL, How does using DISTINCT affect performance?

I am attempting to select a distinct list where duplicates are created over several fields. For example, SELECT tablename.field1Date, tablename.field2Number, tablename.field3Text FROM tablename; Would select duplicating records over the date, number and text fields respectively. Now, when I select distinct records t...

Help with SQL query.

Hello. I have the following table on a MySQL 5.1.30: CREATE TABLE article ( article_id int(10) unsigned NOT NULL AUTO_INCREMENT, category_id int(10) unsigned NOT NULL, title varchar(100) NOT NULL, PRIMARY KEY (article_id) ); With this information: 1, 1, 'foo' 2, 1, 'bar' 3, 1, 'baz' 4, 1, 'quox' 5, 2, 'quonom' 6, 2, 'qox' ...

Showing data and counting from multiple databases in MySQL

I have two tables, that is joined in some way. I've spent the last hour googling around, not finding any concrete answers that worked in my case. The case is, table 1 is called Clients, and table 2 is called Projects. I need to list all the client names, followed by number of projects related to that project and the project title. For ...

mysql query

i have the following table in my databse.. CREATE TABLE IF NOT EXISTS `client` ( `CARD_NO` varchar(15) NOT NULL, `F_NAME` varchar(20) NOT NULL, `L_NAME` varchar(20) NOT NULL, `SEX` varchar(5) NOT NULL, `DOB` date NOT NULL, `SUBCITY` varchar(10) NOT NULL, `KEBELE` varchar(5) NOT NULL, `HOUSE_NO` varchar(10) NOT NULL, `T...

SQL Query with accents from Foreign Languages

Hello, I have a simple column filled with words, many from foreign languages, I need to query based on the "English" letters, ie E, e, é, è, etc should be returned for query of "E" so école should be returned as a result which exists in the database when I query for "E" I can't really find a way to Google this, so help would be gre...

UNION a final ROW in MDX

Hi, I'm quite new to MDX and im having some trouble getting the following t-sql query to MDX. select distinct System from Systen where System <> 'MIS' UNION SELECT 'ALL' So far i got something like this. But i have no idea how to add that final row 'ALL'. SELECT {} ON COLUMNS, {[Concesionario].[Sistema].[Sistema].ALLMEMBE...

MDX - Sum at lowest time, then Max it out...

I have; a Time dimension (Year, Month, Day, Hour), a Product dimension (Product, Feature) and a User dimension (User) The measure I have available is: Used (Number of features that are in use) What I want to do, is to display the Max of concurrent usage. (This would be the Max of the Sum of Used for each Feature used by the same Use...

Ignoring a NULL parameter in T-SQL

I want to be able to pass in a list of parameters, and ignore the ones which are NULL. So that the query is in effect pretending that the filter isn't there and ignoring it. I was doing it like this: (@thing IS NULL or Thing=@thing) Is this right, and if so, would it perform badly? It's seems to be a lot slower than constructing the...

SQL - Select rows from two different tables

Having this table Table "Items" itemID itemTitle itemContent and this Table "MyList" userID itemID deleted how can I select all rows from table "Items" and showing the field "deleted", even if the itemID do not exist in "MyList", given an userID? Example of the query result: itemID | itemTitle | deleted | userID ---------------...

Can I get the T-SQL query generated from a LinqDataSource?

I´m using the LinqDataSource to populate a grid. But now I need the SQL query that the LinqDataSource generates, to pass around throught methods (no, I can't modify the methods to not need a SQL query). Is there a way to obtain the generated SQL query from a instantiated and configured LinqDataSource? ...

How can I return a list of records based on contiguous time assignments in SQL Server 2000

I have a Table that looks like this: IP Hostname TransactionDate ------------- ---------- ------------------- 1.1.1.1 A 2009-01-01 01:00:00 1.1.1.1 A 2009-01-02 01:00:00 1.1.1.1 A 2009-01-03 01:45:00 1.1.1.1 B 2009-01-04 01:00:00 1.1.1.1 A 2009-01-05...

How to return the latest row written for the day?

I have a table with a FooId and a CreatedTime column. During the day, multiple rows can be inserted for the same FooId. The CreatedTime column represent the time at the moment of the inserting. I would like a query which will return me the latest row for a given day (e.g. 2000-01-01). Is there a way to write a query which will do that ...

Live xpath search in your browser

Is there a tool or browser plugin (not sure if Firebug can do this) that will let you open a web page and then using the tool/plugin to search using an xpath query and it will highlight the things on the screen that match your query? ...

How to search for a string in the whole database?

I have an informix database consisting of a large number of tables. I know that there is a string "example" somewhere inside some table, but don't know which table it is or which column it is. (I know this is a very rare case) Because of the large number of tables, there is no way to look for it manually. How do i find this value insid...

Complex queries in SQL Server 2005 database

I have a table in my database in which records conceptually can be children of other rcords. The table has a non-null name field. I need to ensure that each name in a set of children is unique, but not across the entire database. I'd like to enforce this using a constraint inside the Database. What's the best way to accomplish this? I kn...

JPA and Hibernate Fetch ignoring Associations?

I have JPA entity (Object A) with a One-Many owning relationship (Object B) in an ArrayList. I want to be able to query (either Hibernate or JPA) for Object A without having any of the instances of association Object B returned (no proxies or otherwise) in the One-Many ArrayList. Ideally the returned ArrayList would be null or empty. ...

MySQL: Finding rows that don't take part in a relationship

I have two tables: 'movies' and 'users'. There's an n:m relationship between those, describing what movies a user has seen. This is described with a table 'seen' Now i want to find out for a given user, all the movies he has not seen. My current solution is like this: SELECT * FROM movies WHERE movies.id NOT IN ( SELECT seen.movie...