Hello,
we have some user forms that include a 'period' menu, where the user can request the server to return data for a specific date range, such as "Purchase Orders issued between the 1st and the 10th of October 2008".
The logic is then to add "on the fly" the date range to the original sql query and requery the data. The syntax of t...
For the statistics part of an application there are several queries that often change and are also rather long. Both IMHO arguments to remove the queries from the source code and put them somewhere where they can be easily edited in an eye friendly format and also copy / pasted from and to a QL editor. This disqualifies named-queries fro...
Hi
I hope someone can help me with my faltering steps to formulate a SQL query for the following problem.
I have a simple table that records visitor names and dates. The relationship is many to many, in that for any given date there are many visitors, and for any given visitor there will be one or more dates (i.e. repeat visits). There ...
Can anyone tell me why the following is happening, and how to fix it?
I have a MySQL query with an ORDER BY clause that looks like this..
ORDER BY (did_voteup-did_votedown) DESC, did_voteup DESC
So it should order the results by their "effective" rating, as in..
1st. 10 up - 1 down = 9 effective
2nd. 10 up - 5 down = 5 effective
3rd...
hi there,
what is the easiest way to save PL/pgSQL output from a PostgreSQL database to a csv file? I'm using PostgreSQL 8.4 with pgAdmin III and psql plugin where I run queries from...
thanks!
martin
...
$sql= "select
tblservergroup.id,
tblservergroup.groupname,
if(tblservergroup.defserverpaid='0', '0', select concat(tblservers.ipaddress, ' (', tblservers.name, ')' ) as defaultserverpaiddesc from tblservers where tblservers.id=tblservergroup.defserverpaid),
if(tblservergroup.defserverfree='0', '0...
I have a table, sessionBasket, that holds a list of the items in the shopping baskets of visitors to my site. It looks like:
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
usersessid VARCHAR
date_added DATETIME
product_id INT
qty INT
My add to basket script first checks for the presence of an item with the current product_id in this table ...
Hi all, I am storing pages for websites in a 'pages' database table, they are referenced by their path (i.e. 'articles/my-first-blog-post'), I need to select all the children of a particular page, but without selecting grandchildren.
So if I run:
SELECT * FROM pages WHERE path LIKE 'articles%'
I'll get pages with the following paths:...
I manage a website for an organization that has separate chapter sites. There is a membership signup form that is on the main website that each chapter links to. On the form there is a dropdown box that allows a person to choose the chapter they want to join. What I would like to do is have each chapter website use a specific link to ...
I have a DataModule with XML and I need do a search...
Unfortunately there are more than 300,000 records and I can't make a loop to check one-by-one.
Is it possible to make a query without using a database?
Is there another solution?
...
Is it possible to get a history of queries made in postgres? and is it be possible to get the time it took for each query? I'm currently trying to identify slow queries in the application I'm working on.
I'm using Postgres 8.3.5
...
I am trying to execute this following procedure in SQL Server 2005. I was able to execute this in my development server and when i tried to use this in the Live Server I am getting an Error "Internal Query Processor Error: The query processor could not produce a query plan. For more information, contact Customer Support Services". am usi...
I am trying to compare a series of strings like the following
rodeo rodas
carrot crate
GLX GLX 1.1
GLX glxs
the comparision need not be case sensitive
i am trying to write a sql where i am updating the first string with the second string if they match approximately. Here except the second string all the other exampl...
I have this query, which executes in 1 or 2 seconds for a given case:
Select Count(*) as qtty
From event e
Join org o On o.orgID = e.orgID
Join venue v On v.venueID = e.venueID
Where Match( e.name, e.description ) Against ( $keywords )
And e.site_id = $site_id
And e.display <> 0</code>
I...
Hello,
I realize that the exact question has been asked before on stack overflow with only a vaguely conclusive answer: link
So here it is again.
Table A: Has an integer column which is nullable, along with an index.
Query: SELECT * from table WHERE column IS null LIMIT 10;
Will an index be used, or will mysql do a full table scan un...
I have a two tables for ex:
cities - id_city, city_name
properties - id_property, id_city, property_name
I want to display cities.city_name and next to it [properties.count(id_city)]
How do I make a query that still return ZERO if no records founds istead on NULL
so I get results like
London [123]
New York [0]
Berlin [11]
and NEW...
I have 2 tables resulted from merging the following tables:
Authors
-Aid bigint
-Surname nvarchar(500)
-Email nvarchar(500)
Articles
-ArId varchar(50)
-Year int
-……Some other fields……
ArticleAuthors
-ArId varchar(50)
-Aid bigint
Classifications
-ClassNumber int
-ClassDescription nvarchar(100)
ClassArticles
-ArId varchar(5...
I am trying to do an SQL query on two tables to retrieve multiple columns with a certain column (PostID) to be distinct (and it is not the primary key of the that table).
In addition, I need the selected distinct rows to be the latest (one of the columns retrieved is the entry date).
Detailed description:
I am building a forum like ap...
setup:
mysql> create table product_stock(
product_id integer, qty integer, branch_id integer);
Query OK, 0 rows affected (0.17 sec)
mysql> create table product(
product_id integer, product_name varchar(255));
Query OK, 0 rows affected (0.11 sec)
mysql> insert into product(product_id, product_name)
values(1, 'Aps...
I'm having some trouble getting the number of posts and topics for each of the forums on the database. I can get these values doing 2 queries but I wonder if it is possible to do it with only one query.
This query gets the number of topics per forum:
select forums.forumId, forums.forumName, count(*) as Topics FROM Topics
INNER JOIN fo...