Re: OT: SQL Question

2012-03-25 Thread David Turner
@lists.mysql.com Sent: Friday, March 23, 2012 7:28 PM Subject: OT: SQL Question My question is not specific to MySQL, even though I am using a MySQL db for this project. I have a servlet/jsp/MySQL web site in production, and there are about 2,000 records in the flights table. One of the foreign keys

OT: SQL Question

2012-03-23 Thread Mark Phillips
My question is not specific to MySQL, even though I am using a MySQL db for this project. I have a servlet/jsp/MySQL web site in production, and there are about 2,000 records in the flights table. One of the foreign keys is teacher_id. Up to this point, there is a one to many relationship between

Re: OT: SQL Question

2012-03-23 Thread Michael Dykman
A many-to-many is generally best accomplished with a third linking table which contains the ids of the 2 records being linked ie. create table tflink ( flightid int; teacherid int; ); On Fri, Mar 23, 2012 at 10:28 PM, Mark Phillips m...@phillipsmarketing.biz wrote: My question is not specific

SQL Question

2009-11-03 Thread Phibee Network Operation Center
Hi i request a small help for know if it's possible. Anyone know if they have a Sql request for search the best value at one information: Sample: i have a table with: ID int 5 Chaine int 16 and this entry: 1 12345 2 123 3 12 i am search a request in WHERE : Chaine LIKE

RE: SQL Question

2009-11-03 Thread Martin Gainty
+0100 From: n...@phibee.net To: mysql@lists.mysql.com Subject: SQL Question Hi i request a small help for know if it's possible. Anyone know if they have a Sql request for search the best value at one information: Sample: i have a table with: ID int 5 Chaine int 16

Re: SQL question: find items tagged with specific tags

2008-04-23 Thread Ingo Weiss
Thanks, Sebastian! I have tried this one before. The problem is that it finds all items the tags of which include EITHER 'blue' OR 'red', not 'blue' AND 'red': mysql SELECT DISTINCT items.title from items inner join taggings on (items.id = taggings.item_id) inner join tags on (tags.id =

Re: SQL question: find items tagged with specific tags

2008-04-23 Thread Sebastian Mendel
Ingo Weiss schrieb: Thanks, Sebastian! I have tried this one before. The problem is that it finds all items the tags of which include EITHER 'blue' OR 'red', not 'blue' AND 'red': oh ... and ..., i missred SELECT DISTINCT items.* FROM items INNER JOIN taggings ON

SQL question: find items tagged with specific tags

2008-04-22 Thread Ingo Weiss
Hi all, I have an application where items can be tagged. There are three tables 'items', 'taggings' and 'tags' joined together like this: items inner join taggings on (items.id = taggings.item_id) inner join tags on (tags.id = taggings.tag_id) Now I have been struggling for some time

Re: SQL question: find items tagged with specific tags

2008-04-22 Thread Sebastian Mendel
Ingo Weiss schrieb: Hi all, I have an application where items can be tagged. There are three tables 'items', 'taggings' and 'tags' joined together like this: items inner join taggings on (items.id = taggings.item_id) inner join tags on (tags.id = taggings.tag_id) Now I have been

Re: SQL question

2007-06-15 Thread Edward Quick
Is it just this line I need to change? INNER JOIN url_categories uc ON uc.ID=bt.category_ID; Would it change to something like: INNER JOIN url_categories uc ON CAST(uc.ID as CHAR)=delimit(bt.category_ID) Just guessing! Thanks - that's what I thought. I really don't have much experience with

SQL question

2007-06-14 Thread Edward Quick
Hi, I have the following mySQL query in my script which has been working fine but due to a recent change, I had to modify one of the columns, bt.category_ID. This used to be defined as tinyint(3) but I've changed that now to varchar(20) as it needs to hold values such as 15, or 74:79 or

Re: SQL question

2007-06-14 Thread Edward Quick
Thanks, that's interesting. Actually the uc.ID column is still type tinyint as it holds only one number, but are you saying if I change this to varchar my query will work e.g. 15 = 15:17 would work? What is the type of the 'uc.ID' column? If it's varchar, your match will work fine. If

Re: SQL question

2007-06-14 Thread Edward Quick
Thanks - that's what I thought. I really don't have much experience with mySQL. If it's not too much trouble, could someone give me a bit more help on how to do that please? Ed. no, those won't match based on just the datatype change.. you will have to define a user defined function to

Re: SQL Question: alternative to crazy left joins?

2006-03-29 Thread eth1
straight SQL. Ethan -- View this message in context: http://www.nabble.com/SQL-Question%3A-alternative-to-crazy-left-joins--t1357877.html#a3654455 Sent from the MySQL - General forum at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe

SQL Question: alternative to crazy left joins?

2006-03-28 Thread eth1
this: | ContactID| Donation1.* | Donation2.* | Donation3.* | etc... Thanks in advance...off to Ruby to see if I can code some hack quick to get this task done with...;) -Ethan -- View this message in context: http://www.nabble.com/SQL-Question%3A-alternative-to-crazy-left-joins--t1357877.html

Re: SQL Question: alternative to crazy left joins?

2006-03-28 Thread SGreen
this message in context: http://www.nabble.com/SQL-Question%3A- alternative-to-crazy-left-joins--t1357877.html#a3636912 Sent from the MySQL - General forum at Nabble.com. The correct way to model your information is to use the method you describe as being used in the Access database. That data

SQL Question

2006-01-06 Thread Mester József
Hy I want to sum quantites but there is some data that value is negative but users didn't write the - sign before. I can decide which datas are negative. I would like something like that select sum(moved_quantities) from db if moving like 'Move-' then sum seem the move is

Fw: SQL Question

2006-01-06 Thread Rhino
Oops, I meant to send this to the list. Rhino - Original Message - From: Rhino [EMAIL PROTECTED] To: Mester József [EMAIL PROTECTED] Sent: Friday, January 06, 2006 8:44 AM Subject: Re: SQL Question - Original Message - From: Mester József [EMAIL PROTECTED] To: Mysql list

Re: SQL Question

2006-01-06 Thread Gleb Paharenko
Hello. Do you want something similare to this: SELECT SUM(IF(moving like 'Move-',-moved_quantities,moved_quantites)) FROM DB; Have a look here: http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html Mester József wrote: Hy I want to sum quantites but there

Re: SQL Question

2006-01-06 Thread Mester József
Hy If you know which values are supposed to be negative, wouldn't it be easier to do updates to your data to change all of those values to negatives? That should only need to be done once. Then use the normal SQL sum() function to add all of the values together. Thank you. Actually my first

Re: SQL Question

2006-01-06 Thread Rhino
- Original Message - From: Mester József [EMAIL PROTECTED] To: Rhino [EMAIL PROTECTED]; mysql mysql@lists.mysql.com Sent: Friday, January 06, 2006 12:07 PM Subject: Re: SQL Question Hy If you know which values are supposed to be negative, wouldn't it be easier to do updates

RE: [SPAM] - Re: SQL Question - Bayesian Filter detected spam

2006-01-06 Thread Gordon Bruce
. mysql SELECT ABS(2); - 2 mysql SELECT ABS(-32); - 32 This function is safe to use with BIGINT values. -Original Message- From: Rhino [mailto:[EMAIL PROTECTED] Sent: Friday, January 06, 2006 12:19 PM To: Mester József; mysql Subject: [SPAM] - Re: SQL Question - Bayesian

FW: Re: SQL Question

2006-01-06 Thread Gordon Bruce
. mysql SELECT ABS(2); - 2 mysql SELECT ABS(-32); - 32 This function is safe to use with BIGINT values. -Original Message- From: Rhino [mailto:[EMAIL PROTECTED] Sent: Friday, January 06, 2006 12:19 PM To: Mester József; mysql Subject: [SPAM] - Re: SQL Question - Bayesian

Re: SQL question

2005-07-11 Thread Smelly Socks
Hi All! I have a MySQL database (I have them using MySql at work for more stuff now!), and the definition is as follows: uid mediumint(6) NOT NULL auto_increment, ym varchar(6) default NULL, fileid varchar(8) default NULL, off char(3) default NULL, PRIMARY KEY (`uid`) TYPE=MyISAM uid is not

Re: How do I ... SQL question

2005-01-18 Thread Harald Fuchs
In article [EMAIL PROTECTED], [EMAIL PROTECTED] writes: SELECT DISTINCT place FROM a ; place --- south west east Note that the place north does not appear in the last result because north was only visited by bob in 2005 and kim in 2004, records which are not included in

Re: How do I ... SQL question

2005-01-18 Thread SGreen
[EMAIL PROTECTED] wrote on 01/17/2005 06:45:22 PM: Hi there: I have a How do I... SQL question regarding selecting distinct values from a field not included in an aggregated query when LIMIT is in effect, illustrated by the following example: Table a contains the names of individuals

Re: How do I ... SQL question

2005-01-18 Thread Bob
Return only four rows beginning at second row: SELECT count(*) AS count, name, year FROM a GROUP BY name, year ORDER BY count DESC, name ASC LIMIT 4 OFFSET 1; count name year --- -- -- 3 joe2004 s,e,e 2 bob2003 w,e 2 kim

How do I ... SQL question

2005-01-17 Thread zeus
Hi there: I have a How do I... SQL question regarding selecting distinct values from a field not included in an aggregated query when LIMIT is in effect, illustrated by the following example: Table a contains the names of individuals, the places they have visited and the year in which they were

Re: How do I ... SQL question

2005-01-17 Thread Scott Baker
Can't you do: SELECT count(*) AS count, name, year FROM a WHERE place IN ('south','west','east') GROUP BY name, year ORDER BY count DESC, name ASC LIMIT 4 OFFSET 1; [EMAIL PROTECTED] wrote: Hi there: I have a How do I... SQL question regarding selecting distinct values from a field

Re: General Sql question

2004-12-04 Thread Jochem van Dieten
On Fri, 03 Dec 2004 10:58:30 -0700, Steve Grosz wrote: I wrote my query as select Cust_ID, Cust_Name from mailings where ucase(Name) = ucase(Cust_Name) When it runs, I get a error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for

General Sql question

2004-12-03 Thread Steve Grosz
I am kinda new to SQL, and am having a problem trying to get something done. I'm trying to search for usernames in one of my tables. The name is stored as firstname lastname. I wrote my query as select Cust_ID, Cust_Name from mailings where ucase(Name) = ucase(Cust_Name) When it runs, I get a

Re: General Sql question

2004-12-03 Thread SGreen
Your sample query is not valid SQL. What tool/language are you using to run this query? There must be something interpreting what you entered and mis-representing your query to the MySQL server. Without that piece of the puzzle I am completely in the dark. It would also help to know what

Re: General Sql question

2004-12-03 Thread Steve Grosz
I am writing this by hand, and is being used within Coldfusion. MySql is v 4.1.7 and I am connecting via ODBC. Steve [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Your sample query is not valid SQL. What tool/language are you using to run this query? There must be something

Re: General Sql question

2004-12-03 Thread Chris
Does Name exist as a column in your table, or is it a ColdFusion variable? I know very little about how ColdFusion works, but it does parse the query, and alter it, before it gets sent to ODBC. Just looks like it's using ucase(Name) as a coldfusion function, then replacing it in the query. Just

SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread Mike Zornek
I have a table of members, about 13,000 rows. Each night I need to shuffle the table. I have a small int column called random_position. Currently I am creating a position list (based on the count of the members), shuffle it, then while iterating through the members assigning them a a position.

Re: SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread mos
At 11:08 AM 11/29/2004, you wrote: I have a table of members, about 13,000 rows. Each night I need to shuffle the table. I have a small int column called random_position. Currently I am creating a position list (based on the count of the members), shuffle it, then while iterating through the

Re: SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread Mike Zornek
On 11/29/04 12:27 PM, mos [EMAIL PROTECTED] wrote: Mike, Your solution is way too complicated (it makes my head hurt).g Try this: set @n=0; update tmp set rnd = @n := @n + 1 order by RAND() Mike I'll give this a shot. Follow-up question: I've had a lot of trouble with RAND() on

Re: SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread Rhino
- Original Message - From: Mike Zornek [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 29, 2004 12:08 PM Subject: SQL question Trying to improve upon my PHP solution. I have a table of members, about 13,000 rows. Each night I need to shuffle the table. I have

Re: SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread Mike Zornek
On 11/29/04 1:26 PM, Rhino [EMAIL PROTECTED] wrote: I don't think this is a question about SQL at all; I think you already know how to write the SQL to select, insert, update or delete rows. I think that what you really want to know is if there is a more efficient way to shuffle your rows

Re: SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread mos
At 11:53 AM 11/29/2004, you wrote: On 11/29/04 12:27 PM, mos [EMAIL PROTECTED] wrote: Mike, Your solution is way too complicated (it makes my head hurt).g Try this: set @n=0; update tmp set rnd = @n := @n + 1 order by RAND() Mike I'll give this a shot. Follow-up question: I've had a

Re: Simple SQL Question

2004-10-27 Thread Jeff Burgoon
Anybody? Jeff Burgoon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sorry, I forgot to mention I am using version 4.0.20a (no subqueries supported) Jeff Burgoon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a simple problem and I'm just wondering the BEST

Re: Simple SQL Question

2004-10-27 Thread Jay Blanchard
[snip] Anybody? I have a simple problem and I'm just wondering the BEST query to solve it. I want to return all the rows of a table whose foreign key value exists more than once in that table. IE... MyTable Region(foreign key)City EastBaltimore

Re: Simple SQL Question

2004-10-27 Thread gerald_clark
What about select distinct a.region, a.city from mytable a , mytable b where a.region=b.region and a.city b.city Jay Blanchard wrote: [snip] Anybody? I have a simple problem and I'm just wondering the BEST query to solve it. I want to return all the rows of a table whose foreign key

Re: Simple SQL Question

2004-10-27 Thread Jay Blanchard
[snip] What about select distinct a.region, a.city from mytable a , mytable b where a.region=b.region and a.city b.city [/snip] Crud! Standing too close to the forest and forgot about a self join... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: Simple SQL Question

2004-10-27 Thread Jeff Burgoon
Good one. I don't know how I missed this either! Thanks! gerald_clark [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] What about select distinct a.region, a.city from mytable a , mytable b where a.region=b.region and a.city b.city Jay Blanchard wrote: [snip] Anybody? I

Simple SQL Question

2004-10-22 Thread Jeff Burgoon
I have a simple problem and I'm just wondering the BEST query to solve it. I want to return all the rows of a table whose foreign key value exists more than once in that table. IE... MyTable Region(foreign key)City EastBaltimore East

Re: Simple SQL Question

2004-10-22 Thread Jeff Burgoon
Sorry, I forgot to mention I am using version 4.0.20a (no subqueries supported) Jeff Burgoon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a simple problem and I'm just wondering the BEST query to solve it. I want to return all the rows of a table whose foreign key value

Re: An SQL question about using multiple tables

2004-09-09 Thread SGreen
I don't know the source of the INTERSECT command that keeps popping up on the list but this is a straight-forward JOIN situation if I have ever seen one. Please read for more details: http://dev.mysql.com/doc/mysql/en/JOIN.html SELECT A.*, E.* FROM A INNER JOIN B ON A.ID = B.parentid

An SQL question about using multiple tables

2004-09-08 Thread Sandip Bhattacharya
Background: I have one master table A, and other supplementary tables B,C and D such that   for every row of A there can be one or more corresponding rows in B,C,D. There is another supplementary table E with which A has a one-to-one relationship. Problem: Given three search criteria resulting

Re: SQL question, SELECT DISTINCT

2004-08-17 Thread Stephen E. Bacher
I had a similar problem, but my criteria for selecting the value of f1 was different; it's a date field and I wanted only the rows with the most recent date value in that field, so only the latest of otherwise identical entries got inserted. I ended up doing something like this: create temporary

Re: SQL question, SELECT DISTINCT

2004-08-17 Thread Michael Stassen
How about INSERT INTO original_table SELECT MAX(f1), f2, f3 FROM new_table GROUP BY f2, f3; Michael Stephen E. Bacher wrote: I had a similar problem, but my criteria for selecting the value of f1 was different; it's a date field and I wanted only the rows with the most recent date value in

SQL question, SELECT DISTINCT

2004-08-16 Thread leegold
say I'm selecting distinct (non-duplicate) rows for insertion, insert into original_table select distinct * from new_table these tables have 3 fields/row. Per the above code all 3 fields are evaluated by distict * . But my question is: I want to ignore field1, therefore I only want to test

Re: SQL question, SELECT DISTINCT

2004-08-16 Thread SGreen
It all depends on which values of f1 you want to ignore. f1 f2 f3 - - -- val1-1 val2 val3 val1-2 val2 val3 val1-3 val2 val3 Which value of f1 would you want in your new table? Which ones to ignore? Are there other columns (beyond these 3) to move as well?

Re: SQL question, SELECT DISTINCT

2004-08-16 Thread leegold
On Mon, 16 Aug 2004 11:36:32 -0400, [EMAIL PROTECTED] said: It all depends on which values of f1 you want to ignore. f1 f2 f3 - - -- val1-1 val2 val3 val1-2 val2 val3 val1-3 val2 val3 Which value of f1 would you want in your new table? Which ones to

Re: SQL question, SELECT DISTINCT

2004-08-16 Thread SGreen
Let me see if I can explain it a little betterIf you need to move all 3 columns to the new table but you only want *1* row where f2 and f3 have a unique combination of values, how do you want to choose *which* value of f1 to move over with that combination? Do you want the minimum value,

Re: SQL question, SELECT DISTINCT

2004-08-16 Thread leegold
On Mon, 16 Aug 2004 12:39:32 -0400, [EMAIL PROTECTED] said: Let me see if I can explain it a little betterIf you need to move all 3 columns to the new table but you only want *1* row where f2 and f3 have a unique combination of values, how do you want to choose *which* value of f1 to

Re: SQL question, SELECT DISTINCT

2004-08-16 Thread Michael Stassen
You were perfectly clear. We understand that you only want to test f2 and f3 for uniqueness. The question is, which of the possible values of f1 do you want to get. Do you see? For a particular unique f2, f3 combination, there may be multiple f1 values. How should we choose which one to

Re: SQL question, SELECT DISTINCT

2004-08-16 Thread leegold
On Mon, 16 Aug 2004 13:57:13 -0400, Michael Stassen [EMAIL PROTECTED] said: You were perfectly clear. We understand that you only want to test f2 and f3 for uniqueness. The question is, which of the possible values of f1 do you want to get. Do you see? For a particular unique f2, f3

Re: SQL question, SELECT DISTINCT

2004-08-16 Thread Michael Stassen
Then I'd suggest you declare f1 as an AUTO_INCREMENT column in the target table, leave it out of the SELECT, and let it auto-generate IDs. Something like this: INSERT INTO original_table (f2, f3) SELECT DISTINCT f2, f3 FROM new_table; I did that in the same order as your original message,

Re: SQL question, SELECT DISTINCT

2004-08-16 Thread leegold
On Mon, 16 Aug 2004 13:57:13 -0400, Michael Stassen [EMAIL PROTECTED] said: You were perfectly clear. We understand that you only want to test f2 and f3 for uniqueness. The question is, which of the possible values of f1 do you want to get. Do you see? For a particular unique f2, f3

Re: SQL question, SELECT DISTINCT

2004-08-16 Thread leegold
Disregard by last message it's a repeat. THANKS for the help! On Mon, 16 Aug 2004 14:32:27 -0400, Michael Stassen [EMAIL PROTECTED] said: Then I'd suggest you declare f1 as an AUTO_INCREMENT column in the target table, leave it out of the SELECT, and let it auto-generate IDs. Something

Re: mysql sql question

2004-07-07 Thread SGreen
: | | Fax to: | | Subject: Re: mysql sql question

Re: mysql sql question

2004-07-05 Thread Peter Brawley
Bruce, i have two hypothetical tables create table owner ( - name char(20) , - ownerid int(10) auto_increment primary key); create table dog ( - name char(20) , - ownerid int(10), - dogid int(10) auto_increment primary key); i'm curious as to how i'd go about inserting a

mysql sql question

2004-07-04 Thread bruce
hi... i have two hypothetical tables create table owner ( - name char(20) , - ownerid int(10) auto_increment primary key); create table dog ( - name char(20) , - ownerid int(10), - dogid int(10) auto_increment primary key); i'm curious as to how i'd go about inserting a name

Re: mysql sql question

2004-07-04 Thread Paul DuBois
At 12:54 -0700 7/4/04, bruce wrote: hi... i have two hypothetical tables create table owner ( - name char(20) , - ownerid int(10) auto_increment primary key); create table dog ( - name char(20) , - ownerid int(10), - dogid int(10) auto_increment primary key); i'm curious as to

RE: mysql sql question

2004-07-04 Thread bruce
- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: Sunday, July 04, 2004 12:59 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: mysql sql question At 12:54 -0700 7/4/04, bruce wrote: hi... i have two hypothetical tables create table owner ( - name char(20) , - ownerid int(10

RE: mysql sql question

2004-07-04 Thread bruce
-Original Message- From: Emmett Bishop [mailto:[EMAIL PROTECTED] Sent: Sunday, July 04, 2004 12:59 PM To: [EMAIL PROTECTED] Subject: Re: mysql sql question Bruce, what you want it the insert into ... select statement. It's like this: insert into dog (name, ownerid) select name

RE: mysql sql question

2004-07-04 Thread bruce
, tbl2, tbl3.. - -Original Message- From: bruce [mailto:[EMAIL PROTECTED] Sent: Sunday, July 04, 2004 3:26 PM To: 'Emmett Bishop'; [EMAIL PROTECTED] Subject: RE: mysql sql question what you provided would almost do it... but i want to insert into the dog table

RE: mysql sql question

2004-07-04 Thread Quentin Bennett
:41 a.m. To: 'Emmett Bishop'; [EMAIL PROTECTED] Subject: RE: mysql sql question i created the following as a simple test... mysql describe test; +---+--+--+-+-++ | Field | Type | Null | Key | Default | Extra

RE: mysql sql question

2004-07-04 Thread Quentin Bennett
) - select name, id from test where name=sammy; -Original Message- From: bruce [mailto:[EMAIL PROTECTED] Sent: Monday, 5 July 2004 10:50 a.m. To: Quentin Bennett Subject: RE: mysql sql question i can't see how this would work at all... unless you're saying the select will return tom

RE: mysql sql question

2004-07-04 Thread bruce
-Original Message- From: Quentin Bennett [mailto:[EMAIL PROTECTED] Sent: Sunday, July 04, 2004 3:41 PM To: [EMAIL PROTECTED]; Emmett Bishop; [EMAIL PROTECTED] Subject: RE: mysql sql question Hi, You've already specified some values, so you can't then add a 'select' clause as well. Try mysql

RE: mysql sql question

2004-07-04 Thread bruce
: Quentin Bennett [mailto:[EMAIL PROTECTED] Sent: Sunday, July 04, 2004 3:49 PM To: [EMAIL PROTECTED] Cc: MySQL (E-mail) Subject: RE: mysql sql question Hi, The insert says 'insert data in to two columns, name and collegeid'. The select says get two columns, 'tom' and id - 'tom' is a fixed value

Re: mysql sql question

2004-07-04 Thread John Hicks
. Good luck, --John thanks -bruce -Original Message- From: Quentin Bennett [mailto:[EMAIL PROTECTED] Sent: Sunday, July 04, 2004 3:49 PM To: [EMAIL PROTECTED] Cc: MySQL (E-mail) Subject: RE: mysql sql question Hi, The insert says 'insert data in to two columns, name

sql question

2004-03-23 Thread Vincent . Badier
Hello all, I've a table like this : site_1 pkg_name_1 version site_1 pkg_name_2 version site_1 pkg_name_3 version ... site_1 pkg_name_n version site_2 pkg_name_1 version site_2 pkg_name_2 version ... site_2 pkg_name_n version ... site_n pkg_name_1 version ... site_n pkg_name_n

Re: sql question

2004-03-23 Thread Ligaya Turmelle
Maybe something like: Select LIKE pkg_name%, LIKE site_%, version from table group by LIKE pkg_name% , LIKE site_%; but I'm still a beginner. Respectfully, Ligaya Turmelle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all, I've a table like this : site_1 pkg_name_1

SQL question: Finding duplicates

2004-02-03 Thread Simon Detheridge
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Disclaimer: I'm not an SQL expert so please don't laugh. ;-) I'm trying to generate a way to find all rows from a table where the data in column 'foo' is a duplicate of the data in another row. I.E.: row | foo 1 | a 2 | c 3 | b 4 | c 5 |

RE: SQL question: Finding duplicates

2004-02-03 Thread Russell Horn
row | foo 1 | a 2 | c 3 | b 4 | c 5 | a 6 | d the statement would return me rows 1, 2, 4, and 5. CREATE TEMPORARY TABLE temptable SELECT * FROM test GROUP BY foo HAVING COUNT( * ) 1 ORDER BY foo ASC ; SELECT * FROM test, temptable WHERE test.foo = temptable.foo ORDER BY

sql question

2003-11-07 Thread Chris Edwards
Hi Using mysql 3.23.54 I'm trying to join three tables. categories, topics, posts. I just want the categories to print out, with the number of topics in each category, and the number of posts in each topic. ex output: Category | Topics | Posts Cat One | 3

Sql question

2003-10-01 Thread Keith Schuster
Mysql 3.. I can't figure this one out I need to move data from one mysql table to another The hurdle for me is adding additional column values. Here is what I have. insert into mytable (column1, column 2, column3) (Select thiscolumn From anotherTable), '1', now(); It's the 1 and the

Re: Sql question

2003-10-01 Thread Victoria Reznichenko
Keith Schuster [EMAIL PROTECTED] wrote: Mysql 3.. I can't figure this one out I need to move data from one mysql table to another The hurdle for me is adding additional column values. Here is what I have. insert into mytable (column1, column 2, column3) (Select thiscolumn From

RE: Sql question

2003-10-01 Thread Dan Greene
you want to do insert into mytable (column1, column2, column3) (select thiscolumn, '1', now() from anotherTable); Mysql 3.. I can't figure this one out I need to move data from one mysql table to another The hurdle for me is adding additional column values. Here is what I

Re: Newbie SQL question

2003-08-14 Thread Andy Jackman
Keith, You're on the right track. But instead of 2 tables, pretend you have three. 1) Home Teams, 2) Schedule 3) Opponent Teams. In reality tables 1 and 3 are the same table, but you mus't get confused between using 'Teams' as Home Teams and Teams as Opponents. In the same way as you named columns

Newbie SQL question

2003-08-11 Thread Warren, Keith
I'm coming from a Filemaker Pro background and have very little SQL experience. I'm trying to write an SQL statement to extract data from two tables. One table has the Team IDs, Team Names for all the high school football teams in the state. The other table has the schedules for all the games.

basic SQL question

2003-08-06 Thread Gomez Fabre, Pedro Manuel
Dear all, I have the following problem, I am trying to select records from two tables. the tables are constructed like: block block_id sequence_id snp_required first_polymorphism_index last_polymorphism_index first_reference_positio last_reference_position start_pos end_pos tiled_bp

RE: basic SQL question

2003-08-05 Thread Lin Yu
: Gomez Fabre, Pedro Manuel [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 5:19 AM To: [EMAIL PROTECTED] Subject: basic SQL question Dear all, I have the following problem, I am trying to select records from two tables. the tables are constructed like: block block_id sequence_id

Re: (SQL Question) WHERE NOT IN A LIST

2003-07-18 Thread Paul DuBois
At 12:29 -0500 7/18/03, Tom O'Neill (MySQL User) wrote: Hi, Is there a way I can run a query that will delete all items that are not in a list? For example I have a bunch of records in a table and I want to remove all of them that are not in a comma delimited list that I have recieved from

Re: SQL question

2003-06-19 Thread Bruce Feist
Jake Johnson wrote: This is one quick way to get the newest records of a group if you are grouping by the sku and stock. select stock, sku, qty from table where concat(dt_tm,stock,sku) IN ( select concat(max(dt_tm), stock, sku) from table group by stock, sku ) Another approach (also assuming a

Re: SQL question

2003-06-19 Thread Jake Johnson
Nice approach Bruce, but I too won't have any problems with your case because I am grouping by sku and stock in the sub-query. Regards, Jake Johnson [EMAIL PROTECTED] -- Plutoid - http://www.plutoid.com Shop Plutoid for the best

Re: SQL question

2003-06-19 Thread Bruce Feist
Jake Johnson wrote: Nice approach Bruce, but I too won't have any problems with your case because I am grouping by sku and stock in the sub-query. You're right; you do avoid the problem with the specific sample data I gave you. Sorry about that! But, there are still potential problems because

SQL question

2003-06-18 Thread PeterWR
Hi, I have a SQL issue I cannot figure out, perhaps somebody can help / solve / input on this ... I have a table with stock-status transactions like ... 2003-06-17 06:00 stockA SKU1 QTY 98 2003-06-16 06:10 stockA SKU1 QTY 101 2003-06-15 04:59 stockA SKU1 QTY 111 - the time for updating the

Re: SQL question

2003-06-18 Thread Jake Johnson
This is one quick way to get the newest records of a group if you are grouping by the sku and stock. select stock, sku, qty from table where concat(dt_tm,stock,sku) IN ( select concat(max(dt_tm), stock, sku) from table group by stock, sku ) Regards, Jake Johnson [EMAIL PROTECTED]

SQL question - no CREATE VIEW in mysql

2003-02-24 Thread Luca Pizzinato
Hi People. SQL problem: given a table where each column is a number, let's say that I wish to create a second table where columns are the sum of specific columns of the first, i.e.: col_1 + col_2 + col_3 + col_4 col_1 of second table col_5 + col_6 + col_7 + col_8 col_2 of

Re: SQL question - no CREATE VIEW in mysql

2003-02-24 Thread Stefan Hinz
Luca, In Oracle I could create a view from the initial table, what about MySQL? MySQL will support views as of version 5.1. I cannot find it in the todo (http://www.mysql.com/doc/en/TODO.html) but I saw it elsewhere. Regards, -- Stefan Hinz [EMAIL PROTECTED] iConnect GmbH

RE: SQL Question

2002-12-16 Thread Darren Young
I have 2 tables in our MySQL database like this: TABLE: customers +--+---+--+-+-+- ---+ | Field| Type | Null | Key | Default | Extra |

Re: SQL Question

2002-12-16 Thread Stefan Hinz, iConnect \(Berlin\)
Fax: +49 30 7970948-3 - Original Message - From: Darren Young [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 16, 2002 11:24 PM Subject: RE: SQL Question I have 2 tables in our MySQL database like this: TABLE: customers

Re: SQL Question

2002-12-16 Thread Keith C. Ivey
On 16 Dec 2002, at 23:50, Stefan Hinz, iConnect (Berlin wrote: I need to construct a query to find out what customers in the database have not booked shipments with us. That means there would be no records in the shipment table for a given customer id. If I get this right, it should

re: SQL question

2002-11-06 Thread Victoria Reznichenko
John, Tuesday, November 05, 2002, 1:50:32 AM, you wrote: JJ I have a callers table and a citylist table. Both tables have a field JJ 'town' and both tables have a field called 'zipcode'. JJ The citylist is a list of cities and their zip codes. JJ citylist.city and citylist.zipcode JJ The

newbie: SQL question

2002-11-04 Thread Admin-Stress
Hi, I am just a starter. Anyone can suggest me good web resources for learning SQL command that I can use (compatible) with mySQL ? I read from www.mysql.com documentation, but it's not complete ... Well, if you have collection for beginner, please :) Thanks, kapot

RE: newbie: SQL question

2002-11-04 Thread Michael Gargiullo
To: [EMAIL PROTECTED] Subject: newbie: SQL question Hi, I am just a starter. Anyone can suggest me good web resources for learning SQL command that I can use (compatible) with mySQL ? I read from www.mysql.com documentation, but it's not complete ... Well, if you have collection for beginner

RE: newbie: SQL question

2002-11-04 Thread jeff
Try this: http://www.devshed.com/Server_Side/MySQL - Hi, I am just a starter. Anyone can suggest me good web resources for learning SQL command that I can use (compatible) with mySQL ? I read from www.mysql.com documentation, but it's not complete ... Well, if you

  1   2   >