Velen schrieb:
Hi,
I need to write up a select statement something like:
Select a.supcode,a.code,b.desc,sum(c.qty),c.dept where
a.supcode=b.supcode and a.code=c.code and a.code=b.code and c.dept
between $tring1 and $tring2. group by supcode
This is fine but the problem is that there is dup
On Mon, Mar 10, 2008 at 1:38 PM, Peter Brawley
<[EMAIL PROTECTED]> wrote:
> Velen,
>
> >My problem is that it is displaying a.sale_id but different customer_name
> >as it is taking sale_id from d and matching cust_code with b
>
> Any non-aggregate SELECTed value that does not have a 1:1 relati
Velen,
>My problem is that it is displaying a.sale_id but different customer_name
>as it is taking sale_id from d and matching cust_code with b
Any non-aggregate SELECTed value that does not have a 1:1 relationship
with your GROUP BY column will show arbitrary results, so the first
thing to ge
In fact my sql statement is like this:
"select b.customer_name Customer,a.sale_id DocNo,a.sale_date Date,a.prod_code
Product,a.quantity Quantity,c.cost_price Cost,a.price Price,
c.prod_description,a.store,d.payMode from sale_trans a,customer_master
b,prod_master c,saletrans_cons d where a.sale
Velen schrieb:
Hi,
I need to write up a select statement something like:
Select a.supcode,a.code,b.desc,sum(c.qty),c.dept where
a.supcode=b.supcode and a.code=c.code and a.code=b.code and c.dept
between $tring1 and $tring2. group by supcode
This is fine but the problem is that there is dup
Hi,
[EMAIL PROTECTED] schrieb:
Hi,
I have 2 tables as follows:
table 1 contains code,order_qty
table 2 contains code,stock_qty
table 1:
code1, 10
code2, 2
code3, 5
table 2:
code1, 3
code3, 5
code1, 4
code3, 2
I need to see the following result:
code | order_qty| stock_qty
code1 | 10
Hi,
On Jan 18, 2008 2:59 PM, RoryGRen <[EMAIL PROTECTED]> wrote:
>
> Hi all
>
> I am quite new to mySQL and have the following question I hope someone can
> help me with:
>
> I have a database table imported directly from MS Access with two of the
> field names having brackets - F(1) and S(1). I d
4 rows in set (0.27 sec)
Query OK, 0 rows affected (0.28 sec)
Hope this helps.
Randall Price
Secure Enterprise Technology Initiatives
Microsoft Implementation Group
Virginia Tech Information Technology
1700 Pratt Drive
Blacksburg, VA 24060
Email: [EMAIL PROTECTED]
Phone: (540) 231-
From: "Ed Lazor" <[EMAIL PROTECTED]>
To: "'Octavian Rasnita'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc:
Sent: Wednesday, June 27, 2007 8:02 PM
Subject: RE: select statement with variable for table_reference?
Hi Octavian,
First, thanks for helping
works" like you're suggesting. I have to add a union for every one
> of
> > the tables data is being stored in. That means I end up selecting
> > something
> > from every product table, regardless of whether the user actually has
> > something in there or not. I
ogy
1700 Pratt Drive
Blacksburg, VA 24060
Email: [EMAIL PROTECTED]
Phone: (540) 231-4396
-Original Message-
From: Ed Lazor [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 26, 2007 6:02 PM
To: Price, Randall; mysql@lists.mysql.com
Subject: RE: select statement with variable for table_refe
o: "'Octavian Rasnita'" <[EMAIL PROTECTED]>;
Sent: Tuesday, June 26, 2007 11:37 PM
Subject: RE: select statement with variable for table_reference?
Ok, I used your approach like this:
--
select i.scanned_barcode
Implementation Group
> Virginia Tech Information Technology
> 1700 Pratt Drive
> Blacksburg, VA 24060
>
> Email: [EMAIL PROTECTED]
> Phone: (540) 231-4396
>
> -Original Message-
> From: Ed Lazor [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 26, 2007 4:37 PM
Thanks for the info Jerry. =)
> -Original Message-
> From: Jerry Schwartz [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 26, 2007 1:59 PM
> To: 'Ed Lazor'; 'Octavian Rasnita'; mysql@lists.mysql.com
> Subject: RE: select statement with variable for ta
vian Rasnita'; mysql@lists.mysql.com
Subject: RE: select statement with variable for table_reference?
Ok, I used your approach like this:
--
select i.scanned_barcode, v.title from inventory as i
left join version as v on i.record_id = v.id
wher
, 2007 4:37 PM
> To: 'Octavian Rasnita'; mysql@lists.mysql.com
> Subject: RE: select statement with variable for table_reference?
>
> Ok, I used your approach like this:
>
> --
> select i.scanned_barcode, v.tit
has
something in there or not. Improving on this idea would be finding a way to
just query the relevant tables... some sort of conditional union. Any
ideas?
-Ed
> -Original Message-
> From: Octavian Rasnita [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 26, 2007 1:02 PM
> To: E
I am using the following method for doing this, but I am sure it is not the
best one:
(select id, title, author, 'book' as type from books)
union
(select id, title, author, 'cd' as type from cds)
union
(select id, title, author, 'dvd' as type from dvds)
where ...
order by ...
limit ...;
Octavia
>I know about "SHOW COLUMNS FROM tabname", but am looking for something
>more SQL-y, because I want to use the results as part of a larger SQL
>statement. For example, I want to find all the tables in a given db
>that don't have a column named 'timestamp'.
>I thought the 'mysql' system db may hav
Hi Kelly,
Kelly Jones wrote:
In PostgreSQL, the following SELECT statement will return all the
columns for 'tabname':
SELECT x.attname FROM pg_attribute x, pg_class y WHERE
x.attrelid=y.oid AND relname='tabname';
Does MySQL have anything similar?
I know about "SHOW COLUMNS FROM tabname", but
You want to use a LEFT JOIN, which will select all the records from A and link them with records in B if there are any. If there are
no matches in B, the the fields from B will be NULL. You then just check for the NULL value (no match) in a B field and use that as
your filter.
SELECT A.*,B.D FR
Aaron Cannon wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi all. I hope this is the right place to ask this.
I have two tables, A and B. Each of these tables has a column with
integers. The column in table A is C and the one in B is D.
SELECT c.value FROM c WHERE c.value NOT IN
I think you want
SELECT * FROM a LEFT JOIN b on a.c = b.d WHERE b.d IS NULL;
The LEFT JOIN means to create a composite record from both tables even if
there is no match on the right-hand table. Checking to see if b.d is null
selects out those composite records that came up empty on the right-hand
How about
SELECT * FROM queLog
WHERE accessed = "Y"
AND targetApp = "acadreg"
AND enteredQue >= '2004-11-09 18:00:00';
(You said greater than first, then you said greater than or equal to. I
went with the latter.)
Michael
Kory Wheatley wrote:
I'm trying to do a select statement where:
fi
You are comparing the page_url column to a constant string (the contents of
$url_field). Constant strings must be quoted in SQL (otherwise they look
like column names). Since you use double quotes around the whole string,
you must escape double quotes within the string. Without escaping, you
Craig Hibbert wrote:
SELECT FROM_UNIXTIME(time) FROM srvlog WHERE FROM_UNIXTIME(time >=
'1080948600') AND FROM_UNIXTIME(time <= '1080997876');
Why do you have FROM_UNIXTIME() in the WHERE clause? You said
the "time" column was already in Unix time, and regardless, you're
passing the function the
onday, May 24, 2004 12:16 PM
Subject: Re: Select statement returning to many answers
> Jonas Lind?n <[EMAIL PROTECTED]> wrote:
> > Hello, I am running MySQL5.0.0 on my OpenBSD system. When I excute this
> > query I get 153 hits.
> >
> >SELECT b.batch_id, b.date
Hello Jonas,
Looking to the second query I think you're having a "cartesian product". For each row
in one table you get all the rows from the other table. (And that's usually not the
intended result.) This is because there is no join between the tables.
I think that adding a where clause to you
Jonas Lind?n <[EMAIL PROTECTED]> wrote:
> Hello, I am running MySQL5.0.0 on my OpenBSD system. When I excute this
> query I get 153 hits.
>
>SELECT b.batch_id, b.date, b.creator, b.comments FROM cd_batch as b;
>
> But when I add this table to the where clause i get 5831 hits
>
>SELECT b.
> Hello, I am running MySQL5.0.0 on my OpenBSD system. When I excute this
> query I get 153 hits.
>
> SELECT b.batch_id, b.date, b.creator, b.comments FROM cd_batch as b;
>
> But when I add this table to the where clause i get 5831 hits
>
> SELECT b.batch_id, b.date, b.creator, b.comments F
>I am trying to get a single result from a database, which works fine at
>the sql command line. I have tried several versions of code, this being
>the most recent -
...
>No matter what I do I do not get the desired max id number from the column
>WarrantyID. The same query works fine at the sql c
Thanks for the tip. Got it working.
--
Chip
"Rick Emery" <[EMAIL PROTECTED]> wrote on 03/22/2004 09:50:59 AM:
> What result are you getting?
>
> First off, I see that your HTML is possibly incorrect; should it be:
> echo "Warranty ID:\n";
>
> is a table header.
>
> Second, if you are expectin
Hi,
Assuming that you are connecting to the mysql server with success, try just changing
your query to:
$sql = "select max(WarrantyID) as WarrantyID from warrantycopy";
Hope this helps,
Diana Soares
-Original Message-
From: Chip Wiegand [mailto:[EMAIL PROTECTED]
Sent: Mon 3/22/200
What result are you getting?
First off, I see that your HTML is possibly incorrect; should it be:
echo "Warranty ID:\n";
is a table header.
Second, if you are expecting a single result row, then you do not need the while()
loop. Do a
single fetch and display the result.
rick
"People will for
You'll need to create a temporary table and then join the
result:
CREATE TEMPORARY TABLE tmp
SELECT unique_est_id, min(evalue) AS evalue
FROM blast_hit_master_seq2_unique_est_swiss_prot
GROUP BY unique_est_id;
SELECT a.*
FROM blast_hit_master_seq2_unique_est_swiss_prot AS
On Thu, Nov 06, 2003 at 10:36:08AM -0800, Jay Frumkin wrote:
> Hello all,
>
> I am fairly new to MySQL. I have a problem, that I have not been able to
> figure out. I've tried searching the net and reading the manual, but all to
> no avail.
>
> I have two databases (A and B) which have the sa
from one dan to another.
select man.description as man_description, cat.description as cat_description
from main_table as main, manufacturer_table as man, categories_table as cat
where main.manufacturer_id = man.manufacturer_id
and main.category_id = cat.category_id
and title_id = 3
Dan
>I need to know which id is not present in the other table.
Stefan:
A left join should do it:
select t1.id from t1 left join t2 on t1.id=t2.id where t2.id is null
I learned this from this mailing list about two weeks ago.
HTH.
Randy
--
MySQL General Mailing List
For list archives: http://lists
Stefan Berger escribió:
How to tell it in MySQL
I have 2 tables and i want to find difference (the id exists in one
table but in the other not) between them.
With SELECT attachment_id from tbl_attachment, tbl_msg2atta where
attachment_id = atta_id
i receive all id wich are equals in both tabl
On Wed, 1 Oct 2003 10:56:59 +0200
"Stefan Berger" <[EMAIL PROTECTED]> wrote:
>
> I have 2 tables and i want to find difference (the id exists in one
> table but in the other not) between them.
>
> With SELECT attachment_id from tbl_attachment, tbl_msg2atta where
> attachment_id = atta_id
> i
Darryl,
The following query would return all rows in employee that existed in emp2
(**Assuming 'employee' and 'emp2' have a common field 'key').
SELECT e1.* FROM employee AS e1, emp2 AS e2 WHERE e1.key = e2.key;
There is a great book that introduces SQL (SQL-1 and SQL-2 concepts) titled
"The
On Thu, 4 Sep 2003 13:57:53 -0500, Darryl Hoar <[EMAIL PROTECTED]>
wrote:
Joins can in fact be rather confusing at first. The MySQL manual doesn't
help out much, either, I'm afraid. There are lots of good references
available though. I don't know of any online right off hand, but _SQL
Queries
hi
use ` instead of ' may solve the problem.
regards
benny
- Original Message -
From: "Zach" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 06, 2003 7:04 PM
Subject: Select statement with a field name that is a number?
I'm trying to use a select statement for a tab
On 6 Aug 2003 at 12:04, Zach wrote:
> I'm trying to use a select statement for a table that uses numbers for
> the field names. Here is the query I've been trying. Please help!
>
> SELECT * FROM table_name WHERE '18'=1; (18 is the field name, 1
> obviously is the value I'm looking for.)
If it's
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tue, 27 May 2003 16:33:45 +0200, Anthony Ward wrote:
>SELECT userid,subject,date,code FROM testing WHERE userid="testid"
>
Use only single quotes.
- --
jimoe at sohnen-moe dot com
pgp/gpg public key: http://www.keyserver.net/en/
-BEGIN PGP
Dear John,
probably the problem does not derive from MySQL, but from the URL encoded
search string, e.g.:
Search for "oneword" => oneword
Search for "two words" => two%20words
If you match against "two words", there will be no match, as it should match
against "two%20words".
I am not informed
thanks for the chuckle. we've all been beginners
and i still do dumb things with sql.
download corereader from http://corereader.com
it will let you click on the database objects to
build your queries. when you click on your table
name and your field name, it will return the data
to you an
> When I run SELECT * FROM POSTCODE; in mysql prompt I get garbled display of
> data and some of my data is not shown.
the garbled display is probably due to the results being wider then the
screen/terminal, and since the mysql client doesn't implement a horizontal
scrollbar like a gui/web mysql
You should write:
SELECT postcode FROM TABLE_NAME;
This will display the postcode from your table?
Jfernand
** sql **
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: November 20, 2002 16:12
To: [EMAIL PROTECTED]
Subject: SELECT Statement Question
Hi
I am a
John Chang wrote:
In the output table I see:
I Spy Eddie Murphy
I Spy Kelly Robinson
I Spy Owen Wilson
This discussion has taken place in the last two weeks before; what
you're missing is that it doesn't matter what your output looks like in
mysql; you're supposed to format it in your progr
" want to see something like this:
I SPY Eddie Murphy, Kelly Robinson, Owen Wilson
OR
I SPY Eddie Murphy
Kelly Robinson
Owen Wilson"
-- Not sure if you can return the column value of title only once, but when
you are displaying the field you can hide it then.
"Here is the
ESCAPE
Mite help...?
Simon
MySQL
-
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To un
* Andrew Wilson
> Hi guys,
> I was wondering if anyone knew of a paramter that can be put on
> the end of a
> select statement when querying a table which only pulled out one unique
> record based on a field.
... LIMIT 1
> I.e
> If i had a drink database and in it were 10 cokes 10 fantas 10
>
Andrew,
Wednesday, October 16, 2002, 11:01:05 AM, you wrote:
AW> I was wondering if anyone knew of a paramter that can be put on the end of a
AW> select statement when querying a table which only pulled out one unique
AW> record based on a field.
AW> I.e
AW> If i had a drink database and in it
At 21:21 -0700 9/21/02, Des Dougan wrote:
>I want to extract data into a temporary table such that unique
>records with the same primary key (in this case an invoice number)
>are written to one record, with each of the unique fields extracted
>being written to a separate field in the temporary
Hi,
If I have two MYSQL tables with two columns for email addresses respectively:
csc_teammembers.tes_email AND cscflash_mb.email
Now, what I want to do is query only those email addresses in cscflash_mb that
DO NOT have a match in the csc-teammembers dbtable.
Can I just do a select statement
suggested in your previous post.
Thanks,
- Tom Jones
[EMAIL PROTECTED]
- Original Message -
From: "Carsten H. Pedersen" <[EMAIL PROTECTED]>
To: "Tom Jones" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, January 12, 2002 15:35
Subject:
On Sat, 12 Jan 2002, Tom Jones wrote:
> >Table: flights
> >Fields: depart, depart_time, arrive, arrive_time, flight_no, flight_group
>
> I'm trying to do a search on "depart" and "arrive" and show only the records
> which have matching "flight_group"
SELECT depart, arrive
FROM flights
WHERE
> Hello,
> I've been trying to figure this out but I feel like I'm just
> banging my head
> on the wall.
That must be quite painful...
> I hope this is the right forum to pose this question.
It's certainly one of the better ones, yes.
> I have a table of flights which has several fields
>
> >T
I found an easier way... switch the datatype to decimal, WHAMMO!! works
beautifully!
- Original Message -
From: "Steve Rapaport" <[EMAIL PROTECTED]>
To: "Todd Williamsen" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, December 29, 2001
Todd, this result is perfectly correct if they are both strings:
"52.50" is greater than "358". To make them interpreted as
numbers instead, see the manual page:
http://www.mysql.com/doc/C/o/Comparison_Operators.html
Steve
Todd Williamsen wrote:
> I have a record that keeps track of averages
"DL Neil" <[EMAIL PROTECTED]> on 12/06/2001 05:27:55 PM
Internet mail from:
Please respond to "DL Neil" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
cc: <[EMAIL PROTECTED]>
Subject: Re: select statement group by unusual results
Hi Chip,
Hi Chip,
> Thanks for the tips. So here's my latest attemp:
>
> select distinct Title, Details, StartDate, StopDate, City, State
> from phpCalendar_Details t1, phpCalendar_Daily t2, phpCalendar_EventLocations t3
> where t1.LocationID = t2.LocationID
> and t1.EventLocationID = t3.EventLocationID
>
"DL Neil" <[EMAIL PROTECTED]> on 12/06/2001 12:26:45 AM
Internet mail from:
Please respond to "DL Neil" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
cc: <[EMAIL PROTECTED]>
Subject: Re: select statement group by unusual results
Chip,
> &
Chip,
> > I have a database with 12 tables. I am running a query to select certain
> > fields
> > from 3 of the tables, like this -
> >
> > select Title, Details, StartDate, City, State
> > from phpCalendar_Details, phpCalendar_Daily, phpCalendar_EventLocations
> > where phpCalendar_Details.Event
"DL Neil" <[EMAIL PROTECTED]> on 12/05/2001 11:35:46 PM
Internet mail from:
Please respond to "DL Neil" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
cc:
Subject: Re: select statement group by unusual results
Chip,
> I
Chip,
> I have a database with 12 tables. I am running a query to select certain
> fields
> from 3 of the tables, like this -
>
> select Title, Details, StartDate, City, State
> from phpCalendar_Details, phpCalendar_Daily, phpCalendar_EventLocations
> where phpCalendar_Details.EventLocationID =
I am assuming from your email that the field ID allows duplicates. In that
case, use the SELECT DISTINCT syntax ... that will get you back the 1 row
you are looking for. However, if the (ID,CompetitorName) tuple is unique,
SELECT DISTINCT will NOT help.
Hope this helps
Raj
At 06:12 PM 9/23/200
>> But also consider, if you don't want to ask for
>>
>> select
>> subject,subhead,subsubhead,data2,data3,see_also
>> from npl_detail
>>
>> where (subject like '% asia %'
>> AND NOT subject like '%winter%')
>> OR
>> ORDER BY
>> s
--- Werner Stürenburg <[EMAIL PROTECTED]> wrote:
>
>
> Calvin Xu schrieb am Donnerstag, 23. August 2001,
> 03:16:09:
>
> > select
> subject,subhead,subsubhead,data2,data3,see_also
> > from npl_detail where ( (subject like '% asia %'
> OR
> > subhead like '% asia %' OR subsubhead like '% asia
>
Calvin Xu schrieb am Donnerstag, 23. August 2001, 03:16:09:
> select subject,subhead,subsubhead,data2,data3,see_also
> from npl_detail where ( (subject like '% asia %' OR
> subhead like '% asia %' OR subsubhead like '% asia %'
> or data2 like '% asia %' or data3 like '% asia %' or
> see_also li
select table1.colOne as one, table2.colOne as two from table1,
table2 where some condition...
Later fetch the values with names one and two.
Sie schrieben am Freitag, 20. Juli 2001, 23:55:45:
> I have two tables and both tables have a field name thats the same. I
> need to display
> both those
>I have a table called CONTENT. Columns called ID (primarykey), DOCUMENT
>(varchar(50)), DESCRIPTION (text). People submit files to our intranet and
>we collect info. about them in this table. If people have made changes to
>the doc. they just resubmit it to the intranet. So there can be many re
73 matches
Mail list logo