Re: [PHP-DB] Select from multiple tables

2012-03-01 Thread Kranthi Krishna
ny relations Kranthi. http://goo.gl/e6t3 On 1 March 2012 21:47, Carl Michael Skog wrote: > -- Vidarebefordrat meddelande -- > Från: Carl Michael Skog > Datum: 1 mars 2012 17:12 > Ämne: Re: [PHP-DB] Select from multiple tables > Till: Kranthi Krishna > &

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Karl DeSaulniers
This is just a stab in the dark and may be in the wrong order. If it does not work I apologize. SELECT s.Title, (SELECT DISTINCT b.Board_id), (SELECT DISTINCT t.type), (SELECT s.School_id AND b.School_id AND t.schoolid AS id ) FROM school s, board_entries b, schooltypeentries t WHERE id = 1

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Kranthi Krishna
Hi all, SELECT DISTINCT s.Title, b.Board_id, t.type FROM school s, board_entries b, schooltypeentries t WHERE s.School_id = 1698 AND b.School_id = 1698 AND t.schoolid = 1698 this SQL query gives me Kendriya Vidyalaya 15 Kick Boxing Kendriya Vidyalaya 15 Karate Kendriya Vidyal

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Karl DeSaulniers
Try DISTINCT On Feb 29, 2012, at 10:28 PM, Amit Tandon wrote: Dear Kranthi You have to be clear what you decide especially when you are getting multiple rows. To get just a single row you can use LIMIT clause. But it would return only one row. Now you have to decide which row. So i think y

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Amit Tandon
Dear Kranthi You have to be clear what you decide especially when you are getting multiple rows. To get just a single row you can use LIMIT clause. But it would return only one row. Now you have to decide which row. So i think you decide on what you require and see how can you uniquely identify

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Kranthi Krishna
Hi, The examples I saw were regarding cartesian join not inner join. I will read about inner joins. Also, the example i mentioned seems to be a mistake. Both school and type will not be similar at the same time Kranthi. http://goo.gl/e6t3 On 1 March 2012 09:26, Kranthi Krishna wrote: > Hi,

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Kranthi Krishna
Hi, Thanks for the input. I have seen some tutorials on joins, they all suggest that MySql returns multiple rows For example -- School | Board 1 -- School | Board 1 - Now if I have another one-to-many relation -

Re: [PHP-DB] Select from multiple tables

2012-02-29 Thread Matijn Woudt
On Wed, Feb 29, 2012 at 3:01 PM, Kranthi Krishna wrote: > Hi all, > > Say I have an object like > > array >    schoolName => string >    board => array >         string >         string > > I generally create  two MySql tables > > schools: id PRIMARY KEY, SchoolName > boards: id FOREGIN KEY refers

Re: [PHP-DB] SELECT

2011-10-21 Thread tamouse mailing lists
On Fri, Oct 21, 2011 at 2:09 AM, Ford, Mike wrote: >> -Original Message- >> From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] >> Sent: 20 October 2011 21:37 >> >> On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike >> wrote: >> >> -Original Message- >> >> From: Ron Piggott [mai

RE: [PHP-DB] SELECT

2011-10-21 Thread Ford, Mike
> -Original Message- > From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] > Sent: 20 October 2011 21:37 > > On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike > wrote: > >> -Original Message- > >> From: Ron Piggott [mailto:ron.pigg...@actsministries.org] > >> Sent: 17 October 2

Re: [PHP-DB] SELECT

2011-10-20 Thread tamouse mailing lists
On Thu, Oct 20, 2011 at 3:36 PM, tamouse mailing lists wrote: > On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike wrote: >>> -Original Message- >>> From: Ron Piggott [mailto:ron.pigg...@actsministries.org] >>> Sent: 17 October 2011 18:38 >>> >>> I need help creating a mySQL query that will sele

Re: [PHP-DB] SELECT

2011-10-20 Thread tamouse mailing lists
On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike wrote: >> -Original Message- >> From: Ron Piggott [mailto:ron.pigg...@actsministries.org] >> Sent: 17 October 2011 18:38 >> >> I need help creating a mySQL query that will select the correct >> introduction message for a website I am making.  The

Re: [PHP-DB] SELECT

2011-10-18 Thread Jim Giner
Ron - Mike here is correct. I gave you a start, but it had a problem with it. Hope I didn't have you running around too much. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] SELECT

2011-10-18 Thread Ford, Mike
> -Original Message- > From: Ron Piggott [mailto:ron.pigg...@actsministries.org] > Sent: 17 October 2011 18:38 > > I need help creating a mySQL query that will select the correct > introduction message for a website I am making. The way I have > designed the table I can’t wrap my mind aro

Re: [PHP-DB] SELECT

2011-10-17 Thread Amit Tandon
Dear Ron If only day is required u could add another day condition in the where clause e.g. month(current_date) between and day(current_date) between. i think u require something more than this. So could u pls explain your requirement in a little more detail say what would be the output of the que

Re: [PHP-DB] SELECT syntax

2011-10-13 Thread Karl DeSaulniers
Heh, Thanks Karthik. Not my post.. :) But your solution looks dead on.. Here you go Ron. Try this one. Best, Karl On Oct 13, 2011, at 2:42 AM, Karthik S wrote: Try this, select CASE answer when 1 then trivia_answer_1 when 2 then trivia_answer_2 when 3 then trivia_

Re: [PHP-DB] SELECT syntax

2011-10-13 Thread Karl DeSaulniers
Or something like this? SELECT * FROM `Bible_trivia` WHERE answer=`answer`; Then match the results to trivia_answer_1 in php to see if correct. if($trivia_answer_1 == $results) { ... do this } or a switch switch ($results) { case $trivia_answer_1: ... do this cas

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Amit Tandon
another example regds amit "The difference between fiction and reality? Fiction has to make sense." On Thu, Oct 13, 2011 at 9:34 AM, Amit Tandon wrote: > select > case

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Amit Tandon
select case works in mysql also regds amit "The difference between fiction and reality? Fiction has to make sense." On Thu, Oct 13, 2011 at 3:26 AM, Jack van Zanen wrote: > Hi > > In Oracle (and maybe others) you

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Jack van Zanen
Hi In Oracle (and maybe others) you can use select case when answer=1 then trivia_answer_1 when answer=2 then trivia_answer_2 when answer=3 then trivia_answer_3 when answer=4 then trivia_answer_4 else null end answer from bible_trivia_table OR You can select all of them and process in PHP, shou

RE: [PHP-DB] SELECT syntax

2011-10-12 Thread Toby Hart Dyke
Not terribly elegant, but this should work: SELECT `trivia_answer_1` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=1 UNION SELECT `trivia_answer_2` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=2 UNION SELECT `trivia_answer_3` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=

Re: [PHP-DB] SELECT online store discount %

2011-08-22 Thread Ron Piggott
011 5:45 AM To: Ron Piggott Cc: php-db@lists.php.net Subject: Re: [PHP-DB] SELECT online store discount % Ron Have u thought of CASE (in SELECT). Remebber their is some syntactical difference in "CASE" for SELECT and "CASE" in procedures regds amit "The diff

Re: [PHP-DB] SELECT online store discount %

2011-08-22 Thread Amit Tandon
Ron Have u thought of CASE (in SELECT). Remebber their is some syntactical difference in "CASE" for SELECT and "CASE" in procedures regds amit "The difference between fiction and reality? Fiction has to make sense."

Re: [PHP-DB] SELECT WHERE length of content question

2011-03-09 Thread Daniel Brown
On Wed, Mar 9, 2011 at 17:49, Ron Piggott wrote: > > Is there a command in mySQL that would allow me to SELECT the rows where the > `fax` column is more than 11 characters long? There is. SELECT * FROM tblName WHERE CHAR_LENGTH(fax) >= 11; (Presuming you meant greater than or equal

Re: [PHP-DB] SELECT WHERE length of content question

2011-03-09 Thread kesavan trichy rengarajan
Have a look at this: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_char-length On Thu, Mar 10, 2011 at 9:49 AM, Ron Piggott wrote: > > Is there a command in mySQL that would allow me to SELECT the rows where > the `fax` column is more than 11 characters long? > > OR > > D

Re: [PHP-DB] SELECT / ORDER BY

2010-09-13 Thread Richard Quadling
On 11 September 2010 07:47, Ron Piggott wrote: > > I wrote the query below to determine the 10 most popular words used: > > SELECT COUNT( `bible_concordance_usage`.`reference` ) AS word_usage, > `bible_concordance_words`.`reference` , `bible_concordance_words`.`word` > FROM `bible_concordance_usag

Re: [PHP-DB] SELECT / ORDER BY

2010-09-11 Thread Karl DeSaulniers
Hello, This may help. http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html Best, Karl On Sep 11, 2010, at 1:47 AM, Ron Piggott wrote: I wrote the query below to determine the 10 most popular words used: SELECT COUNT( `bible_concordance_usage`.`reference` ) AS word_usage, `bible

Re: [PHP-DB] Select the specific user data from the database

2010-09-05 Thread Phpster
I would suggest that you keep authorization separate from data access Bastien Sent from my iPod On Sep 5, 2010, at 9:19, nagendra prasad wrote: > PS: Want to check the username from a table and the password from another > table. > > Is it possible ?? > > -- PHP Database Mailing List (http

Re: [PHP-DB] Select the specific user data from the database

2010-09-05 Thread nagendra prasad
PS: Want to check the username from a table and the password from another table. Is it possible ??

Re: [PHP-DB] Select the specific user data from the database

2010-09-05 Thread Phpster
Then each record needs to have a user filed where their is stored. Then your access query just adds an additional filter to check this value Select * from data_table where user = $user Bastien Sent from my iPod On Sep 5, 2010, at 7:21, nagendra prasad wrote: > Hi Experts, > > I have a mysql

Re: [PHP-DB] SELECT with ' in search term

2010-08-12 Thread Chris
On 13/08/10 13:26, Ron Piggott wrote: If the variable $segment has an ' in it the $query won't work because of having 3 ' 's. Should I be using: $segment = mysql_real_escape_string($segment); before querying the database? Use it in your query. Don't use it anywhere else. Your code may use it

Re: [PHP-DB] SELECT LIKE with "%" and without "%"

2010-02-24 Thread Ahmet Caner
"Eleonora De Marinis" , haber iletisinde sunlari yazdi:49fe92d0.2060...@garr.it... > $sql = "SELECT * FROM table WHERE ID ='$_GET[id]' AND title LIKE > '%$_GET[word]%'"; > > > > Original Message > Subject: [PHP-DB] SELECT LIKE with "%'" and without "%'" > From: Emiliano Boragin

Re: [PHP-DB] SELECT LIKE with "%" and without "%"

2009-05-04 Thread Philip Thompson
On May 2, 2009, at 6:43 PM, Emiliano Boragina wrote: Hello. I am using this: $sql = "SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE '%$_GET[word]%'"; But I want exactlu ID, not one part of many possibles Ids in the DB. How can I do that? PLEASE tell me your cleaning that inpu

Re: [PHP-DB] SELECT LIKE with "%" and without "%"

2009-05-04 Thread Eleonora De Marinis
$sql = "SELECT * FROM table WHERE ID ='$_GET[id]' AND title LIKE '%$_GET[word]%'"; Original Message Subject: [PHP-DB] SELECT LIKE with "%'" and without "%'" From: Emiliano Boragina To: php-db@lists.php.net Date: 05/03/2009 01:43 AM Hello. I am using this: $sql = "SELECT *

Re: [PHP-DB] SELECT LIKE with "%" and without "%"

2009-05-02 Thread mrfroasty
Emiliano Boragina wrote: > Hello. > > I am using this: > $sql = "SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE > '%$_GET[word]%'"; > This doesnt work? $sql = "SELECT * FROM table WHERE ID='some_id' AND title='some_title'; -- Extra details: OSS:Gentoo Linux profile:x86 Hardw

Re: [PHP-DB] Select query with Forein key Relation

2008-04-23 Thread Evert Lammerts
of columns do i need to do following in php /while ($row = mysql_fetch_array($result)) {/ /$sub= $row[venue].[vname];/ /}/ Regards - Original Message From: Evert Lammerts <[EMAIL PROTECTED]> To: Nasreen Laghari <[EMAIL PROTECTED]> Cc: php-db@lists.php.net Sent

Re: [PHP-DB] Select query with Forein key Relation

2008-04-23 Thread Evert Lammerts
SELECT * FROM gig LEFT JOIN genre ON gig.genreId = genre.genreId LEFT JOIN venue ON gig.venueID = venue.vid WHERE gig.gigid = $gigdetail I'd replace the dash with [table].[columnames]. Also, you're using four different naming conventions in your columns - gigid, genreId, venueID and vid. If I w

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Ron Piggott
Thanks On Mon, 2008-03-10 at 12:56 +1300, Bruce Cowin wrote: > I think what you mean to do is use IN(). And I would suggest table aliases. > So it could look like this: > > SELECT * FROM ministry_directory md INNER JOIN > ministry_directory_listing_categories mdlc ON md.entry = > mdlc.minist

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Bruce Cowin
I think what you mean to do is use IN(). And I would suggest table aliases. So it could look like this: SELECT * FROM ministry_directory md INNER JOIN ministry_directory_listing_categories mdlc ON md.entry = mdlc.ministry_directory_entry WHERE md.listing_type = 2 AND mdlc.ministry_directory_

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Chris
Ron Piggott wrote: Two different rows Chris. That's the problem then. Your query is saying "get records with category_reference of 10 and it has to have category_reference of 11 as well". No such rows exist. Maybe that should be an 'or' or 'in' (same thing). ... ministry_directory_listi

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Ron Piggott
Two different rows Chris. reference ministry_directory_entry ministry_directory_category_reference 13 1 10 14 1 11 What I am trying to do is allow the user to make a more specific search. Ron On Mon, 2008-03-10 at 10:37 +1100, Chris wrote: > > > ministry_directory_list

Re: [PHP-DB] SELECT query from two tables

2008-03-09 Thread Chris
ministry_directory_listing_categories.ministry_directory_category_reference = 10 AND > ministry_directory_listing_categories.ministry_directory_category_reference = 11 Can a record really have a reference for two different id's like this? ie can it be both '10' and '11' at the same time?

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread TG
$query = mysql_query("SELECT * FROM gig WHERE gigName='$gig_name' OR gig_fdate='$sdate'"); You only use the WHERE clause once then use parenthesis, AND and OR to create the logical conditions. If you have access to the mysql server, maybe through phpMyAdmin or something, I'd highly recommend

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Stephen Johnson
$query = mysql_query("SELECT * from gig WHERE gigName='$gig_name' or gig_fdate='$sdate'"); You can not use more then one WHERE in your sql statement... And SQL accepts OR and AND.. -- Stephen Johnson c | eh The Lone Coder http://www.thelonecoder.com continuing the struggle against bad code h

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Stut
On 27 Feb 2008, at 23:44, Nasreen Laghari wrote: Thank you for increasing my knowledge about PHP/MYSQL. The question you ask below is basic SQL syntax. Please read the MySQL manual before asking here - answers at this level are all in there. http://mysql.com/doc Oh, and once you have it wo

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Daniel Brown
On Wed, Feb 27, 2008 at 6:44 PM, Nasreen Laghari <[EMAIL PROTECTED]> wrote: > I am creating a SEARCH, by only using one table. The search form is same as > Inserting item (search has form of all fields in table ), difference is > SEARCH page doesnt have validation . Therefore user can enter inf

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Chris
Greg Bowser wrote: In MySQL, both "OR" and "||" are valid logical or operators. You can only have one Where clause, thus your last example is correct. Though in postgresql and db2 (and some other dbs) "||" means "concatenate" so stick with using the word "OR" in this situation otherwise you'

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Greg Bowser
In MySQL, both "OR" and "||" are valid logical or operators. You can only have one Where clause, thus your last example is correct. --GREG On Wed, Feb 27, 2008 at 6:44 PM, Nasreen Laghari <[EMAIL PROTECTED]> wrote: > Hi All, > > Thank you for increasing my knowledge about PHP/MYSQL. > > I am cr

Re: [PHP-DB] SELECT query with multiple "WHERE" Clause

2008-02-27 Thread Chris
$query = mysql_query("SELECT * from gig WHERE gigName='$gig_name' OR WHERE gig_fdate='$sdate'"); This one. I'd suggest you get a book to help you with the basics, something like this should do (first hit in amazon, haven't actually read this particular book): http://www.amazon.com/Learni

Re: [PHP-DB] Select...

2008-01-15 Thread OKi98
Original Message Subject: [PHP-DB] Select... From: Miguel Guirao <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: 15.1.2008 4:44 Hello List, I'm having kind of trouble to get done this: Select data from a table, except those data already in a second table. Actually, if ther

Re: [PHP-DB] Select...

2008-01-15 Thread Niel Archer
Hi First off, please create your own thread, do not reply to someone else's and change the subject. > I'm having kind of trouble to get done this: Select data from a table, > except those data already in a second table. Actually, if there is a rowid > in table2, I wont get it from table1, rowid

Re: [PHP-DB] ? "SELECT TABLE" Command

2007-09-10 Thread Mike W.
Chris wrote (in news:[EMAIL PROTECTED]): > > It is an SQL query (probably MySQL, but perhaps SQLite or possibly even PGSQL or mSQL): > > The line after $query should tell you what uses it ;) Sorry, I meant the book may have been about any of those; I was skimming through a bunch of SQL books at t

Re: [PHP-DB] ? "SELECT TABLE" Command

2007-09-10 Thread Chris
Please fix your reply-to address. It is an SQL query (probably MySQL, but perhaps SQLite or possibly even PGSQL or mSQL): The line after $query should tell you what uses it ;) $query="SELECT TABLE $tablename;"; if (mysql_query($query, $link)) { echo($indent."The table, '$tablen

RE: [PHP-DB] SELECT string

2007-04-24 Thread Dwight Altman
Businesses -- id businessName isChristianBookstore isGift isHomeDecor isSkinCareAndCosmetics isThriftStore CREATE TABLE `Businesses` ( `id` BIGINT NOT NULL AUTO_INCREMENT , `businessName` VARCHAR( 64 ) NOT NULL , `isChristianBookstore` TINYINT( 1 ) NOT NULL , `isGift` TINYINT( 1 ) NOT NUL

Re: [PHP-DB] SELECT string

2007-04-23 Thread bedul
cmiiw.. since i don't the visual what u said bellow - Original Message - From: "Ron Piggott" <[EMAIL PROTECTED]> To: "PHP DB" Sent: Tuesday, April 24, 2007 11:31 AM Subject: [PHP-DB] SELECT string > > I am looking for help to write a SELECT syntax to help me process a > directory searchi

Re: [PHP-DB] SELECT date query

2006-10-08 Thread Bastien Koert
i tend to take the approach of $next_wed = date("Y-m-d", strtotime("next wednesday")); Bastien From: Niel Archer <[EMAIL PROTECTED]> Reply-To: php-db@lists.php.net To: php-db@lists.php.net Subject: Re: [PHP-DB] SELECT date query Date: Sat, 07 Oct 2006 05:49:36 +0

Re: [PHP-DB] SELECT date query

2006-10-07 Thread Niel Archer
Hi > You can make this easier with date('w'). Doh, that'll teach me to code at 5 am. I knew there was a better way, but couldn't think of it, the sound of my bed calling was too distracting. Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsu

Re: [PHP-DB] SELECT date query

2006-10-07 Thread Hodicska Gergely
Hi! You can make this easier with date('w'). $correction = array(3, 2, 1, 7, 6, 5, 4); list($year, $month, $day, $dayOfWeek) = explode('|', date('Y|m|d|w')); echo date ("Y.m.d", mktime (0,0,0,$month,$day+$correction[$dayOfWeek],$year)); Regards, Felhő Niel Archer wrote: Hi Ron I've ma

Re: [PHP-DB] SELECT date query

2006-10-06 Thread Niel Archer
Hi Ron I've made the assumption that if today is Wednesday, you still want next Wednesday. Try this: $offset = array(3,2,1,7,6,5,4); $date = explode("-", date("Y-n-j")); $ToDay = DayOfWeek($date[0], $date[1], $date[2]); $NextWed = date("Y-n-j", time() + ($offset[$ToDay] * 24 * 60 * 60)); // Retu

RE: [PHP-DB] Select distinct field won't return distinct value

2006-06-08 Thread tg-php
have the link) on who to create a cross table query which is what you are looking for Bastien >From: "Blanton, Bob" <[EMAIL PROTECTED]> >To: ><[EMAIL PROTECTED]>,,<[EMAIL PROTECTED]> >Subject: RE: [PHP-DB] Select distinct field won't return distinct v

RE: [PHP-DB] Select distinct field won't return distinct value

2006-06-07 Thread Bastien Koert
000929062 2341 001139768 2207 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 06, 2006 7:48 PM To: php-db@lists.php.net Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Select distinct field won't return distinct value Correct me if

Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-07 Thread Martin Alterisio
the subquery is the only way to go. -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 07, 2006 8:50 AM To: Blanton, Bob Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Select distinct field won't return distinct value Blanton, Bob wrote: > I'm just

RE: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Blanton, Bob
: php-db@lists.php.net Subject: Re: [PHP-DB] Select distinct field won't return distinct value Blanton, Bob wrote: > I'm just learning MySQL so don't know all the syntax. There is a "LIST" > function in Sybase Adaptive Server Anywhere which would do that. Is >

Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Chris
Blanton, Bob wrote: I'm just learning MySQL so don't know all the syntax. There is a "LIST" function in Sybase Adaptive Server Anywhere which would do that. Is there an equivalent function in MySQL? Query: SELECT distinct niin, list(serial_number) FROM fmds.maintenance_equipment group by niin

RE: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Blanton, Bob
, June 06, 2006 7:48 PM To: php-db@lists.php.net Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Select distinct field won't return distinct value Correct me if I'm wrong, but it sounds like you have something like this: 123 Joe 124 Joe 125 Sue 126 John 127 Joe 128 Frank 129 Sue An

Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Mohamed Yusuf
I thank you all. problem solved using two queries as TQ mentioned. On 6/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Correct me if I'm wrong, but it sounds like you have something like this: 123 Joe 124 Joe 125 Sue 126 John 127 Joe 128 Frank 129 Sue And you want to output somethi

Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread tg-php
Correct me if I'm wrong, but it sounds like you have something like this: 123 Joe 124 Joe 125 Sue 126 John 127 Joe 128 Frank 129 Sue And you want to output something like: Joe 123, 124, 127 Sue 125, 129 John 126 Frank 128 But what you're getting is: Joe 123 Joe 124 ..etc You have two

Re: [PHP-DB] Select distinct field won't return distinct value

2006-06-06 Thread Brad Bonkoski
Perhaps you should fix your data model... but with your current set up, try: select cus_name, cus_id from customers group by cus_name order by cus_name asc -Brad Mohamed Yusuf wrote: I want select distinct field and return value of that field, but I have problem which is: select distinct re

RE: [PHP-DB] SELECT

2006-01-20 Thread Bastien Koert
Convert both to unix timestamps...be much easier to wrok with both date and time then bastien From: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: PHP DB Subject: [PHP-DB] SELECT Date: Fri, 20 Jan 2006 06:00:33 -0500 Yesterday I asked how to get the date & time 90 m

Re: [PHP-DB] SELECT

2006-01-20 Thread Adrian Bruce
Possibility? WHERE (`date_created` = '$date_90_minutes_ago' AND `time_created` <= '$time_90_minutes_ago') or (`date_created` < '$date_90_minutes_ago' AND `time_created` > '01:30:00') Ade Ron Piggott (PHP) wrote: Yesterday I asked how to get the date & time 90 minutes ago and I received se

Re: [PHP-DB] SELECT

2005-12-10 Thread Julien Bonastre
Have you considered the GROUP BY statement of SQL?? For example if this is a table's data: msg_iduservarnamevalue 2 1yadahello 3 1yadahows it going? 4 2yada

Re: [PHP-DB] SELECT

2005-12-10 Thread Julien Bonastre
oOo-- - Original Message - From: "Philip Hallstrom" <[EMAIL PROTECTED]> To: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> Cc: "PHP DB" Sent: Sunday, December 11, 2005 11:20 AM Subject: Re: [PHP-DB] SELECT I am trying to put together a SELECT synt

Re: [PHP-DB] SELECT

2005-12-10 Thread Philip Hallstrom
I am trying to put together a SELECT syntax. I am querying a response database and I only want to obtain each user's name once even if they have given more than 1 response. $query="SELECT * FROM conversation_table WHERE conversation_reference = $conversation_currently_displayed"; $response_cre

Re: [PHP-DB] SELECT & html

2005-12-05 Thread Amol Hatwar
On Sun, 2005-12-04 at 13:38 -0500, Ron Piggott (PHP) wrote: > I have two questions. > > I would like to display the contents of my table with the first row > being grey in background and the next row being white and the third row > being grey, fourth being white, etc. I am not sure how to do th

RE: [PHP-DB] SELECT & html

2005-12-04 Thread Robbert van Andel
There's a couple of ways to do this. For the row color you would set that as you looped through the returned rows. Using the pear db class: $count = 0; echo "\n"; while($db->fetchInto($data)) { $count++; if($count % 2 == 0) { $bgColor = "background-color:#dcdcdc";

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-18 Thread Dwight Altman
key, so I was wondering if some type of composite index on (field2, field3) would be better. Then again, any combination with field1 would also be unique. - Original Message - From: "Micah Stevens" <[EMAIL PROTECTED]> To: Sent: Thursday, August 18, 2005 12:33 PM

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-18 Thread Micah Stevens
ld2 9 const 10 Using where; Using > filesort > > > - Original Message - > From: "Micah Stevens" <[EMAIL PROTECTED]> > To: > Sent: Thursday, August 18, 2005 9:49 AM > Subject: Re: [PHP-DB] SELECT Performance and INDEXing > > > I think no

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-18 Thread Dwight Altman
evens" <[EMAIL PROTECTED]> To: Sent: Thursday, August 18, 2005 9:49 AM Subject: Re: [PHP-DB] SELECT Performance and INDEXing I think no one answered it because it doesn't make a whole lot of sense. Breaking a condition out into a second SQL statement would force the DB to rescan th

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-18 Thread Micah Stevens
I think no one answered it because it doesn't make a whole lot of sense. Breaking a condition out into a second SQL statement would force the DB to rescan the table, so it should take longer rather than shorter. There's nothing suggesting that it's doing an internal self-join or other time-con

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-18 Thread Dwight Altman
Hey, this is my first question. So if you could just reply to say it reached the php-db list, that would be terrific. Of course, answering the questions would be awesome as well. > I meant > 'Analyze table' > and > 'the composite key "field2 field3" would be unique' > > - Original Message --

Re: [PHP-DB] SELECT Performance and INDEXing

2005-08-10 Thread Dwight Altman
I meant 'Analyze table' and 'the composite key "field2 field3" would be unique' - Original Message - From: "Dwight Altman" <[EMAIL PROTECTED]> To: Sent: Wednesday, August 10, 2005 4:23 PM Subject: [PHP-DB] SELECT Performance and INDEXing I have a MyISAM table holding images with fiel

Re: [PHP-DB] select * from table where column 'CONTAINS' more than one value (how?)

2005-06-22 Thread Micah Stevens
On Tuesday 21 June 2005 10:35 pm, Dan Fulbright wrote: > > I have no problem creating a table, using a query from my dbase table > > "news": > > > > SELECT * FROM table where column = VALUE. > > > > However, now that most of our articles have more than one column type > > (i.e. instead of just

Re: [PHP-DB] select * from table where column 'CONTAINS' more than one value (how?)

2005-06-22 Thread Dan Fulbright
I have no problem creating a table, using a query from my dbase table "news": SELECT * FROM table where column = VALUE. However, now that most of our articles have more than one column type (i.e. instead of just technology, the column can now contain "technology, politics, local". You n

Re: [PHP-DB] select * from table where column 'CONTAINS' more than one value (how?)

2005-06-21 Thread Micah Stevens
You can use LIKE and wildcards, which is faster than fulltext searches, which will provide you a lot of information you don't need. Do this: SELECT * FROM table where column LIKE "%politics%" OR column LIKE "%local%" to find if the field contains politics or local.. -Micah On Tuesday 21 J

RE: [PHP-DB] select * from table where column 'CONTAINS' more than one value (ho

2005-06-21 Thread Bastien Koert
use full text searches http://dev.mysql.com/doc/mysql/en/fulltext-search.html bastien From: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] select * from table where column 'CONTAINS' more than one value (how?) Date: Tue, 21 Jun 2005 20:49:12 EDT Hello all, I have no problem c

RE: [PHP-DB] Select

2005-05-17 Thread Bastien Koert
distinc needs a field select distinct(name) from table bastien From: MIGUEL ANTONIO GUIRAO AGUILAR <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] Select Date: Mon, 16 May 2005 19:26:20 -0700 Hi!! I have this query in PHP: $items2 = mysql_query("SELECT DISTINCT * FROM rev ORDER BY re

RE: [PHP-DB] Select

2005-05-17 Thread Juffermans, Jos
Hi, Instead of doing a SELECT *, specify the fields that you require. Allthough you may think the rows are exactly the same, one might be empty ("") and one null which is not the same. You are more likely to get the result that you need if you specify the fields: SELECT DISTINCT somedata, rev, a

Re: [PHP-DB] select text from a text file

2005-01-07 Thread Bastien Koert
read then write, 2 transactions, the second can take place while the user is reading the content bastien From: "Ed" <[EMAIL PROTECTED]> To: "Bastien Koert" <[EMAIL PROTECTED]>,<[EMAIL PROTECTED]> CC: Subject: Re: [PHP-DB] select text from a text file D

Re: [PHP-DB] select text from a text file

2005-01-07 Thread Ed
7;t seem to find the answer. Ed - Original Message - From: "Bastien Koert" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Cc: Sent: Friday, January 07, 2005 2:06 PM Subject: Re: [PHP-DB] select text from a text file > simple, add a

Re: [PHP-DB] select text from a text file

2005-01-07 Thread Bastien Koert
> To: "Andrew Kreps" <[EMAIL PROTECTED]> CC: Subject: Re: [PHP-DB] select text from a text file Date: Fri, 7 Jan 2005 08:58:18 - Hi, Thanks for answering the question. I'm going to make it write to a database rather than text file after searching google and coming accros

Re: [PHP-DB] select text from a text file

2005-01-07 Thread Jochem Maas
last grabbed message after you have selected it for output. have fun! Ed - Original Message - From: "Jochem Maas" <[EMAIL PROTECTED]> To: "Ed" <[EMAIL PROTECTED]> Cc: Sent: Friday, January 07, 2005 11:37 AM Subject: Re: [PHP-DB] select text from a text file

Re: [PHP-DB] select text from a text file

2005-01-07 Thread Ed
ginal Message - From: "Jochem Maas" <[EMAIL PROTECTED]> To: "Ed" <[EMAIL PROTECTED]> Cc: Sent: Friday, January 07, 2005 11:37 AM Subject: Re: [PHP-DB] select text from a text file > Ed wrote: > > Hi, > > > > Thanks for answering the questio

Re: [PHP-DB] select text from a text file

2005-01-07 Thread Jochem Maas
eadable 6 months down the line. Ed - Original Message - From: "Andrew Kreps" <[EMAIL PROTECTED]> To: "Ed" <[EMAIL PROTECTED]>; Sent: Thursday, January 06, 2005 6:55 PM Subject: Re: [PHP-DB] select text from a text file On Wed, 5 Jan 2005 11:58:59 -, Ed <

Re: [PHP-DB] select text from a text file

2005-01-07 Thread Ed
ent: Thursday, January 06, 2005 6:55 PM Subject: Re: [PHP-DB] select text from a text file > On Wed, 5 Jan 2005 11:58:59 -, Ed <[EMAIL PROTECTED]> wrote: > > Happy new year folks! > > > > The titlemight make this seem like an easy to answer question > > > >

Re: [PHP-DB] select text from a text file

2005-01-06 Thread Andrew Kreps
On Wed, 5 Jan 2005 11:58:59 -, Ed <[EMAIL PROTECTED]> wrote: > Happy new year folks! > > The titlemight make this seem like an easy to answer question > > However here's the complicated bit (well for me anyway). > > In my text file that is written to by the users in a chatroom it looks like

Re: [PHP-DB] select particular columns in query

2004-12-08 Thread Doug Thompson
The manual is your friend. You cannot execute the SQL statement you provided because mysql specifically disallows it: http://dev.mysql.com/doc/mysql/en/INSERT_SELECT.html Same reference, your presumption about auto-increment columns is also wrong. Doug blackwater dev wrote: Hello, I want to create

RE: [PHP-DB] select particular columns in query

2004-12-08 Thread Bastien Koert
INSERT INTO `dbname`.`newtablename` SELECT * FROM `dname`.`oldtablename` ; bastien From: blackwater dev <[EMAIL PROTECTED]> Reply-To: blackwater dev <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: [PHP-DB] select particular columns in query Date: Wed, 8 Dec 2004 10:46:44 -0500 Hello, I want to c

Re: [PHP-DB] select query across multiple tables

2004-08-26 Thread Cole S. Ashcraft
Thanks! It works Cole On Thu, 2004-08-26 at 16:45, [EMAIL PROTECTED] wrote: > > I'm trying to pull all the records from the table class where classID is > > not equal to the value of classID in the table assignment. > > > Currently, I have 'select class.classID, class.classDesc from class, > >

Re: [PHP-DB] select query across multiple tables

2004-08-26 Thread jeffrey_n_Dyke
> I'm trying to pull all the records from the table class where classID is > not equal to the value of classID in the table assignment. > Currently, I have 'select class.classID, class.classDesc from class, > assignment where assignment.classID >= class.classID and > assignment.assignmentID=$ass

Re: [PHP-DB] SELECT problem between MySQL 3.23 and MySQL 4

2004-07-02 Thread John W. Holmes
Chris Payne wrote: > I'm using Booleans in my searches (New to it) but it works perfectly on my local 3.23 version of MySQL, but on the main server which uses version 4 of MySQL I get an error so there's an error in my Syntax. Here's what I currently use: [snip] LENGTH(REPLACE(LOWER(def),LOWER('

  1   2   3   >