Welcome, Guest. Please login or register.
Did you miss your activation email?
05/23/12, 01:04
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  General Conversation (Moderators: Flash-db, vesa kortelainen, Ronald Wernecke, Mohsin Sumar, Jorge Solis, Mattias Robo)
| | |-+  Values across multiple tables
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Values across multiple tables  (Read 1675 times)
mrtwister
Server what's that
*
Posts: 1



View Profile Email
« on: 04/21/02, 19:21 »

Okey allow me to explain what I am trying to do here. I am trying to make a comparison with two different tables. store and accounts are the table names, there is a field in store called cost which i am trying to make sure in this query is greater then the field money in table accounts. if the comparison returns a row then i know it is true. I don't belive i should join these tables because none of the data corresponds with each other at all, i just need to be able to make cross table field comparisions. so if cost is 500 in store and money is 600 in accounts of the row in question then the query should return atleast one row.

$query = "SELECT store.itemname, store.cost, store.iteminfo FROM store, accounts WHERE store.cost < accounts.money AND itemid = '$changeitem AND username= $usernamecook";
$result = mysql_query($query);
$numR = mysql_num_rows($result);

Also another question i have is for doing updates to a table with the same theory in mind, could i make calculations based on values from 2 seperate tables??

$resultt = mysql_query("UPDATE accounts SET accounts.money=accounts.money-store.cost WHERE username='$loginusercook'", $Connect);

thanks ya'll for taking the time to look at my problem!!
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything