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

2007-07-02 Thread Chris
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, ordere

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

2007-07-02 Thread David Mitchell
How about a union? SELECT * FROM productgroup WHERE groupid = $productid AND label = 'Cats' ORDER BY title UNION SELECT * FROM productgroup WHERE groupid = $productid AND label != 'Cats' ORDER BY label,title Also, for long-term maintenance, it would probably be better to list the columns rather

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

2007-07-02 Thread tg-php
Yeah, that's a bit of an important piece of information. Some tricks do work across versions of SQL, but not always. Something else you can try is creating an artificial column to sort by. Excuse the code, it's been ages since I've worked with MS SQL so syntax is probably off, but just to dem

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 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, 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 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 "Bob"s first, sorting them by firs

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, ordere

[PHP-DB] sql statement - complex order by

2007-07-02 Thread Bryan
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, ordered by title but

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 t

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 yo

RE: [PHP-DB] SQL statement syntaxis

2005-01-07 Thread Bastien Koert
R BY CompanyName ASC"; bastien From: [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 var

Re: [PHP-DB] SQL statement syntaxis

2005-01-07 Thread Joseph Crawford
the syntax for that looks fine to me what you might want to try doing is something like this if( isset( $_POST['CompanyName'] ) ) { $query_company_listing = "SELECT CompanyID, CompanyName, CompanyOrDepartment, BillingAddress, City, PostalCode, PhoneNumber FROM company WHERE company.Co

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

2005-01-06 Thread Jason Walker
mailto:[EMAIL PROTECTED] Sent: Thursday, January 06, 2005 12:09 PM To: php-db@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

[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

[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, CompanyOrDepartme

[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, CompanyOrDepartme

Re: [PHP-DB] SQL Statement

2004-05-18 Thread John W. Holmes
Thompson, Jimi wrote: So then I try do this â Note that this shouldnât work since it isnât a valid SQL statement. > I'm not sure why PHP doesn't return some kind of an error message. PHP does return an error message, you're just not displaying it. $rswrk = mysql_query($sqlwrk) or die(mysql_err

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

[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 a

[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 Data

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

2002-03-19 Thread Steve Fry
select * 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 - brai

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 eac

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

2002-03-18 Thread Gurhan Ozen
elect * 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 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 > diff

[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 CO

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

2001-02-28 Thread Wesley Choate
[SMTP:[EMAIL 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 giv

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

2001-02-28 Thread Udo Oehmig
scott, try " alter table drop()" -u -Ursprüngliche 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 would allow me t

[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