Re: [PHP-DB] sql statement - complex order by

2007-07-02 Thread Stut
Bryan wrote: SELECT * FROM productgroup WHERE groupid = $productid AND label = 'Cats' ORDER BY title SELECT * FROM productgroup WHERE groupid = $productid AND label != 'Cats' ORDER BY label,title I'd like to find a way to combine these 2 statements. I want to list out all the products,

Re: [PHP-DB] sql statement - complex order by

2007-07-02 Thread tg-php
Try this: SELECT * FROM productgroup WHERE groupid = $productid ORDER BY label = 'Cats' DESC, title The test SQL I did to make sure I understood it was this (against our Users table): select * from users order by first = 'Bob' DESC, first, last It put all the Bobs first, sorting them by

Re: [PHP-DB] sql statement - complex order by

2007-07-02 Thread Bryan
I think there's one small piece of data I left out. I'm working with php/mssql, no mysql. I'll move to mysql when I get everything else built. Mssql 2000 doesn't seem to like the = sign in the order by clause. It looks like both of you so far have come up with the same syntax though so it must

Re: [PHP-DB] sql statement - complex order by

2007-07-02 Thread Bryan
I think there's one small piece of data I left out. I'm working with php/mssql, not mysql. I'll move to mysql when I get everything else built. Mssql 2000 doesn't seem to like the = sign in the order by clause. It looks like both of you so far have come up with the same syntax though so it

Re: [PHP-DB] SQL statement

2005-01-07 Thread Jochem Maas
PHPDiscuss - PHP Newsgroups and mailing lists wrote: Hello everybody, I'm building a small application and I have trouble passing a POST variable form one page to another inside the SQL statement. The query displayed below works great without the .$_POST['CompanyName']. $query_company_listing =

RE: [PHP-DB] SQL statement syntaxis

2005-01-07 Thread Bastien Koert
: [EMAIL PROTECTED] (PHPDiscuss - PHP Newsgroups and mailing lists) To: php-db@lists.php.net Subject: [PHP-DB] SQL statement syntaxis Date: 6 Jan 2005 19:12:16 - Hello everybody, I'm building a small application and I have trouble passing a POST variable form one page to another inside the SQL

Re: [PHP-DB] SQL statement

2005-01-07 Thread Jochem Maas
Jason, can you please turn off the return receipts on emails you send to the list. it's bloody annoying to have 'The Sender wishes to be notified' popup messages everytime I read one of your emails (and, alas, I don't have the skill to hack the return receipt crap right out of Tbird). BTW

Re: [PHP-DB] SQL statement

2005-01-07 Thread graeme
Hi, To stop the return receipt dialog appearing in Tbird... Tools... Options... Advanced... Return Receipt and select Never send a return receipt. Or you can choose some of the other selections. graeme Jochem Maas wrote: Jason, can you please turn off the return receipts on emails you send to

[PHP-DB] SQL statement syntaxis

2005-01-06 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Hello everybody, I'm building a small application and I have trouble passing a POST variable form one page to another inside the SQL statement. The query (displayed below) works great without the .$_POST['CompanyName']. $query_company_listing = SELECT CompanyID, CompanyName,

[PHP-DB] SQL statement syntaxis

2005-01-06 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Hello everybody, I'm building a small application and I have trouble passing a POST variable form one page to another inside the SQL statement. The query (displayed below) works great without the .$_POST['CompanyName']. $query_company_listing = SELECT CompanyID, CompanyName,

[PHP-DB] SQL statement

2005-01-06 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Hello everybody, I'm building a small application and I have trouble passing a POST variable form one page to another inside the SQL statement. The query displayed below works great without the .$_POST['CompanyName']. $query_company_listing = SELECT CompanyID, CompanyName, CompanyOrDepartment,

RE: [PHP-DB] SQL statement

2005-01-06 Thread Jason Walker
@lists.php.net Subject: [PHP-DB] SQL statement Hello everybody, I'm building a small application and I have trouble passing a POST variable form one page to another inside the SQL statement. The query displayed below works great without the .$_POST['CompanyName']. $query_company_listing = SELECT

[PHP-DB] SQL Statement

2004-05-18 Thread Thompson, Jimi
For some background, I've been tasked with building a marketing tracking application by the PHB's who think that being able to write SQL means you can code. I know how to get data into a database and I can do thing with it once it's in there, but this is one of my first attempts at extracting

Re: [PHP-DB] SQL Statement

2004-05-18 Thread Cal Evans
Jimi, PHP does not return an error because it knows nothing about valid sql. It's just knows if it's a valid PHP statement. (which it is because you've got the 's in the right place and a ; at the end. ) :) It's up to MySQL to return an error. As to your statement. 1: It's easier and valid in

Re: [PHP-DB] SQL Statement

2004-05-18 Thread John W. Holmes
Thompson, Jimi wrote: So then I try do this ?php if ($fk_phone != NULL) { $sqlwrk = SELECT `pk_phone_reports`, SUM(`calls`) AS `total_calls`, `date`, `calls` , `fk_ph_num` FROM `phone_reports`; $sqlwrk .= WHERE `pk_phone_number` = . $fk_phone; $rswrk =

[PHP-DB] sql statement via var

2002-05-26 Thread Dave Carrera
Hi All I am trying to load a mysql statement which i have tested and know to work from a var in my script. It is a create table statement. I have a good connection as a table list shows tables. I tried to echo my var but no joy Any ideas? Thanks in Advance Dave C -- PHP

Re: [PHP-DB] SQL statement - PHP/mySQL - brain fart

2002-03-19 Thread Steve Fry
]] Sent: Monday, March 18, 2002 9:22 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] SQL statement - PHP/mySQL - brain fart For some reason I keep thinking that this should be simple - but I just can't seem to figure it out. Help??? Please??? [I've been working on it for two days now.] Overview

[PHP-DB] SQL statement - PHP/mySQL - brain fart

2002-03-18 Thread Summit
For some reason I keep thinking that this should be simple - but I just can't seem to figure it out. Help??? Please??? [I've been working on it for two days now.] Overview: What I'm trying to do is query one table by passing it two different variables - and return only the results that are

Re: [PHP-DB] SQL statement - PHP/mySQL - brain fart

2002-03-18 Thread Jason Wong
On Tuesday 19 March 2002 10:22, Summit wrote: For some reason I keep thinking that this should be simple - but I just can't seem to figure it out. Help??? Please??? [I've been working on it for two days now.] Overview: What I'm trying to do is query one table by passing it two different

RE: [PHP-DB] SQL statement - PHP/mySQL - brain fart

2002-03-18 Thread Gurhan Ozen
* from tmp1, tmp2 where tmp1.si=tmp2.si; Does this work for you?? Gurhan -Original Message- From: Summit [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 9:22 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] SQL statement - PHP/mySQL - brain fart For some reason I keep thinking

Re: [PHP-DB] SQL statement - PHP/mySQL - brain fart

2002-03-18 Thread Frank Flynn
Well it's sorta' simple once you get your mind around this - you need two tables but you've only got one. And there's no OR, you need both to be true for a site_id ... The query would be easy if you actually had two tables so we'll search off of the same table twice giving it different names

[PHP-DB] SQL STATEMENT?????

2001-02-28 Thread Scott Fletcher
Hi! I am looking for a SQL Statement that would allow me to remove a column from the table in the database. Just give me what you know and I'll check out the SQL Reference I have for the database. Don't worry about what type of database do I have, that's what hte SQL Reference is for. (It

AW: [PHP-DB] SQL STATEMENT?????

2001-02-28 Thread Udo Oehmig
scott, try " alter table drop(column)" -u -Ursprngliche Nachricht- Von: Scott Fletcher [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 28. Februar 2001 14:50 An: [EMAIL PROTECTED] Betreff: [PHP-DB] SQL STATEMENT? Hi! I am looking for a SQL Statement that woul

RE: [PHP-DB] SQL STATEMENT?????

2001-02-28 Thread Wesley Choate
PROTECTED]] Sent: Wednesday, February 28, 2001 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] SQL STATEMENT? Hi! I am looking for a SQL Statement that would allow me to remove a column from the table in the database. Just give me what you know and I'll check out the SQL