Re: A tricky Query

2006-10-06 Thread Yashesh Bhatia
hi. can you give more details ? how is effective_price for today calculated - for example if u need price for 11th oct 2006, i'm assuming all u need is the price for date_from / date_to when there's a match in the range. yashesh bhatia. On 10/7/06, abhishek jain <[EMAIL PROTECTED]> wrote: Hi,

A tricky Query

2006-10-06 Thread abhishek jain
Hi, I have a table like : ID date_from date_to price_code price dateadded 1 07:10:2006 31:12:2099 p11007:10:06 2 17:10:2006 31:12:2099 p12007:10:06 3 27:10:2006 31:12:2099 p11007:10:06 4 01:11:2006 31:12:2099 p12007:10:06 5 05:10:2

Re: Tricky query

2006-08-04 Thread Morten
How about: SELECT DISTINCT `key`, COUNT(`key`) AS c FROM `table` WHERE `value` in (8,9,10) HAVING c=3; Clever! Thanks :-) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Tricky query

2006-08-04 Thread Gerald L. Clark
Morten wrote: Hi, Given the table keyval(key int(11), val int(11)), I would like to be able to retrieve the keys for which a row exist for given X values. Example: key value 18 19 110 28 38 310 48 49 410 411 Given values 8, 9, 10 the query should t

Re: Tricky query

2006-08-04 Thread Gerald L. Clark
Morten wrote: Hi, Given the table keyval(key int(11), val int(11)), I would like to be able to retrieve the keys for which a row exist for given X values. Example: key value 18 19 110 28 38 310 48 49 410 411 Given values 8, 9, 10 the query should t

Re: Tricky query

2006-08-04 Thread Morten
Peter Brawley wrote: >Can this be expressed somewhat more elegantly than multiple EXISTS subqueries? >SELECT DISTINCT key FROM keyval outer >WHERE EXISTS (SELECT * FROM keyval inner >WHERE outer.key = inner.key >AND inner.val = 8) >AND EXISTS (SELECT * FROM keyval inner >WHE

Re: Tricky query

2006-08-04 Thread Peter Brawley
>Can this be expressed somewhat more elegantly than multiple EXISTS subqueries? >SELECT DISTINCT key FROM keyval outer >WHERE EXISTS (SELECT * FROM keyval inner >WHERE outer.key = inner.key >AND inner.val = 8) >AND EXISTS (SELECT * FROM keyval inner >WHERE outer.key = inner.key >

Tricky query

2006-08-04 Thread Morten
Hi, Given the table keyval(key int(11), val int(11)), I would like to be able to retrieve the keys for which a row exist for given X values. Example: key value 18 19 110 28 38 310 48 49 410 411 Given values 8, 9, 10 the query should thus return 1 an

Re: Help with tricky query

2005-10-04 Thread Mike Blezien
[EMAIL PROTECTED] wrote: Mike Blezien <[EMAIL PROTECTED]> wrote on 10/04/2005 10:08:24 AM: Hello, [EMAIL PROTECTED] wrote: Mike Blezien <[EMAIL PROTECTED]> wrote on 10/04/2005 08:34:56 AM: Hello, I am trying to put together a single query from across 4 tables and not having a pro

Re: Help with tricky query

2005-10-04 Thread SGreen
Mike Blezien <[EMAIL PROTECTED]> wrote on 10/04/2005 10:08:24 AM: > Hello, > > > [EMAIL PROTECTED] wrote: > > Mike Blezien <[EMAIL PROTECTED]> wrote on 10/04/2005 08:34:56 AM: > > > > > >>Hello, > >> > >>I am trying to put together a single query from across 4 tables and > >>not having a >

Re: Help with tricky query

2005-10-04 Thread Mike Blezien
Hello, [EMAIL PROTECTED] wrote: Mike Blezien <[EMAIL PROTECTED]> wrote on 10/04/2005 08:34:56 AM: Hello, I am trying to put together a single query from across 4 tables and not having a problem getting the results needed. table structure: #

Re: Help with tricky query

2005-10-04 Thread SGreen
Mike Blezien <[EMAIL PROTECTED]> wrote on 10/04/2005 08:34:56 AM: > Hello, > > I am trying to put together a single query from across 4 tables and > not having a > problem getting the results needed. table structure: > ## > CREATE TABLE IF NOT

Help with tricky query

2005-10-04 Thread Mike Blezien
Hello, I am trying to put together a single query from across 4 tables and not having a problem getting the results needed. table structure: ## CREATE TABLE IF NOT EXISTS job_posts ( jobid int(6) unsigned NOT NULL auto_increment, job_vacan

Re: tricky query

2003-10-10 Thread gerald_clark
This is a bit vague. How about showing what you have done, and how it is not what you wan't. Colleen Dick wrote: I am building a SELECT using a left join and I almost have what I want. One of the fields that gets sucked in from the left join is either null or has a value in it. if it is null I

tricky query

2003-10-10 Thread Colleen Dick
I am building a SELECT using a left join and I almost have what I want. One of the fields that gets sucked in from the left join is either null or has a value in it. if it is null I only want to include the rows from the main table where the field isdemo=1 if that field has a value in it I wan

Re: Tricky Query...

2002-04-05 Thread John Klein
[EMAIL PROTECTED] wrote: > > Here is a FABRICATED table I have TYPED OUT to demonstrate the information > that I'm looking for. > I'm looking for a single query that can produce: > > +--+--++---+ > | clientid | revision | name

Tricky Query...

2002-04-05 Thread Daniel Ward
here's the scoop: Basically I'm listing pieces of information from a two-key table and I am not getting the information I want. BACKGROUND Consider this sample table (which although goofy, does illustrate what I'm attempting to do) SELECT clientid, revision, name, address FROM clients; +--

Tricky query : help needed !

2001-07-16 Thread Denis BAURAIN
Hi there, I'm new on this list because of a long query I can't write successfully. I guess I could post my question on a more general SQL list but since my database engine is MySQL I post it here. It's a bit long to read because of the care taken to explain all things. Please forgive me if I'