Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Code To Pull Amount


I'm certain there is a function to do this but I forget what it is...
Say I am pulling values from the database, but I only want to pull like the first 10 chars of the value.. how do I do that?




View Complete Forum Thread with Replies

Related Forum Messages:
SELECT Count(something) As Amount WHERE Amount = 'this'
SELECT search_query, COUNT(search_query) as count
FROM hr_search
WHERE count >= 2
GROUP BY search_query
ORDER BY search_query ASC

I'm building a search cloud and this is the query I want to use to grab all results from my database with more than two entries... however SQL doesnt like me using 'count' in the WHERE statement. Is there any way around this?

View Replies !
Zip Code Column Set As Integer... Removes Extra 0 If Zip Code Ends In A 0
put my zip code column as an integer and not varchar, so now if the rows have a zip code that ends with a 0 it will discard it (for example zip code 64840 will get stored as 6484).

What query can I run to fix this problem to add a zero if the zip code column has 4 digits?

View Replies !
Update Several Columns In A Row - Postal Code Or Zip Code
Ok - I have 125 records. They all have different postal codes. I have a column named "Region". I want to update all postal codes starting with "V" to region "WST".

How can I do this? I know how to update on MASS based on the column, but can I what I need to do?

View Replies !
Java Code Or Pseudo Code For "Outer Join"
I want to implement the "outer join" functionality in Java. Can
somebody explain the pseudo code for the same. OR what needs to be done
to extend the hash-join Java code of equijoin.

View Replies !
Pull All Records
if it were possible to write a statement in SQL where one could select several fields from a table and then limit the records returned by only displaying those where, say, FieldA (a varchar) contains a given short string which could be only a part of the field's contents. As long as a record has this short string in Field A, it should be included in the resulting set of records.Something like this:

SELECT FieldA, FieldB, FieldC
FROM TABLE Table1
WHERE FieldA *contains string*

Is there anything in SQL that could examine the contents of a field for a partial string, and then return the records that have that partial string in that field?

View Replies !
Pull All Usernames
Say I want to pull all usernames beginning with the letter A. How can I do so?

View Replies !
Multiple DB Pull
Lets say there is a database of special users and a database of favorite movies

SPECIAL USERS (username)
bob
jim

FAVORITES (username - movie_title)
bob - movie 1
kim - movie 3
jim - movie 1
larry - movie 2
jane - movie 2

How would I write a query that lists the most popular movies of special users without explicitly doing:

SELECT * FROM FAVORITES WHERE username = 'bob' or username = 'jim' GROUP BY movie_title

I want something like this:

SELECT * FROM FAVORITES WHERE username = [all the usernames from the SPECIAL USERS DB] GROUP BY movie_title

View Replies !
Mysql Pull
I got this in my mysql databe table.
a:1:{i:0;O:19:"test_Enclosure":4:{s:4:"link";s:36:"http://grabber/v/CAcpLiw4qt4.swf";s:4:"type";s:29:"application/x-shockwave-flash";s:6:"length";N;s:10:"javascript";s:2:"js";}}

I want to pull out only the
http://grabber/v/CAcpLiw4qt4.swf part?

View Replies !
Can Input Japanese, Can't Pull It Out
I figured out how to store Japanese characters by setting the collation of a particular field to utf8_bin. I can input Japanese characters, and I can see them just fine under PHPMyAdmin.

The problem is that when I execute a query and print them to a web page, all I get is question marks instead of Japanese characters. This is while using the same browser that allows PHPmyAdmin to display the characters correctly.

I added the following metadata to the <head> portion of the document but it didn't help:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

View Replies !
Populate A Pull Down Menu From Db
how do I populate a pull down menu from a MySQL table?
Using PHP/MySQL 4.0

Have table1 with names and ID and tableb with ID and statistical info.wnt to be able to scroll names and have users able to click on the name to follow a link to a page created using tableb data for each name listed.


Table examples:
tablea
ID l Name
---------------------
1 Person, Joe
2 Smith, Joe


tableb
ID l units l margin
--------------------------------
1 5023 123
2 2536 72

View Replies !
Pull Hosting Plans
I am currently creating a web hosting website for a client of mine, for the packages and the order process we are using a script called "Auto-Host (http://www.idevspot.com/AutoHost.php)", which stores all the hosting plans into a mysql database.

This is a great script and it does exactly what we want it too, the only thing missing is it doesnt create a page where people can view the hosting plans and click a sign-up button. Can someone please give me guidance on how i can get a page with all the hosting plans on please?, alternatively i am willing to pay somebody for doing this on my behalf

View Replies !
Pull The Last 10 Records From A Transactions From A Table
I'm trying to pull the last 10 records from a transactions from a table using this query:

SELECT * FROM transactions ORDER BY timestamp DESC LIMIT 10

But I want to display the rows in ascending order by timestamp. I can't get the subquery below to work and not sure why:

SELECT *
FROM (SELECT *
FROM transactions
ORDER BY timestamp DESC
LIMIT 10)
ORDER BY timestamp ASC;

View Replies !
Pull Related Info Using Subqueries
I'm creating a tool to browse a database of movie listings. The browser
pulls up 25 results at a time, and you can page through them using 'Next'
and 'Prev' tools. Pretty basic stuff.

Here are my tables:
movies
directors
comments
movies_directors
movies_comments
etc...
(primary key is movies.id)

But here's where I'm stuck: for each film, I need to pull the movie info in
'movies', plus any related data from other tables, like this:

The Lord of the Rings | Peter Jackson | 3 comments
Episode II | George Lucas | 0 comments
Indiana Jones | Steven Spielberg | 15 comments

I seem to run into problems when I try to join info from all of these
related tables. If there's a match, great. But, if not (like a movie with no
comments), the movie is excluded from the result set.

I've tried all sorts of SQL queries to make this work, but nothing seems to
do the trick.

SO, HERE'S MY QUESTION, IS THERE ANY WAY TO DO THIS QUERY WITHOUT
SUBQUERIES/MYSQL 4.0? Or would the best approach be to use PHP to do all the
subquery lookups?

View Replies !
Pull Similar Data From Two Tables
I need a query to search two seperate tables for similar data and return them in one result.

I know you can do multiple select statements in one query but I dont know how to exactly organize them into one result. Does anyone know how to accomplish this.

View Replies !
Result Pull And Rating Sort
I have two databases. What I would like to happen is when I have a summary of products, I would like the query to pull the info from the product table and based on the id from that table cross reference with the reviews for that particular product and calculates all the reviews for that product into a single percentage. So when I access the assoc array from PHP I would like to see : Array(Array(['id'] => '2', ['prod_name'] => 'gummy bears', ['rating'] => '72'), Array(['id'] => '57', ['prod_name'] => 'socks', ['rating'] => '52')).

View Replies !
How To Pull Data From Multiple Tables
I have a db, with several tables in it, I have now reached to the point where I need to pull data from several tables. What is the best way to do this?

Should I put a column in each table, and then insert a unique key in all of them at the time the record(row) is being created? If this is the way to do it, when I am putting the unique key in each table would I just do an insert in each of the tables?

View Replies !
Pull Data From Multiple Tables
Can you pull data from 2 tables in the same database onto the same page? What about more than 2 tables?

Here is my dilema: I currently have a database with 1 table, and a ton of rows. The information is property information, and each property has multiple empty suites. As of now, I have columns for Building Name, Address, and then columns for Unit Type A (for the first unit), Rent A, Type B, Rent B, etc....

I was wondering if I would be able to put the listings we have into thier own property table, and then one bigger table of all the properties individual information. Keep in mind I need to call all tables together on my portfolio pages, so I would be connecting to quite a few tables at once.

Or my other option I was thinking about was to just have 2 tables: 1 Buildings info, and 1 units info.

Which of these would you do, or how would you organize this data.

View Replies !
Regular Expression :: Pull 3 Or 4 Digit Numbers
I would like to pull all the model number from my products table that are strictly only a 3 or 4 digit number ie:

034 or 3542 or 0243 or 934 etc

Can someone advise me on how to construct a regular expression to give me the data I need?I have tried the following but it wasnt 100% accurate:

Code:

products_model REGEXP "[[:<:]][0-9][0-9][0-9][0-9][[:>:]]" or products_model REGEXP "[[:<:]][0-9][0-9][0-9][[:>:]]"

View Replies !
Pull Data From Ibdata And Ib_logfile Files
I lost the data in a scheme and the only logs I have are the ibdata and ib_logfile files. Is there anyway to parse the data from these files to rebuild my data set?

View Replies !
Pull Info From One Database To Save In A Session To Push To A Different DB
I'm building a dynamic site that has 3 data bases. One DB contains all
of my store info ID#, Name, Address, Phone. Another DB contains member
info ID, Name, address, email,phone,etc...
The 3rd DB Tracks when a user logs in and logs out at a store. This DB
has the following columns Store ID, Member ID, log in time,log out
time, time in store.

The stores log in in the morning that starts a session-I need the
session to pull the store's info ID#, Name,etc... so when a user logs
in, in the store. The login page inserts the store ID, Store name, and
user ID into the 3rd DB.

There are a lot of stores how do I get the store variables to be
inserted into the DB?

View Replies !
Pull Data From 2 Database Tables Into 1 Table On My Site.
I got 2 tables: a dev_tasks and a task_history table. The task table has to record information about the task I am working on AND the history table is for the task history logs. I am trying to display info from both tables into 1 table on my site.

Most of the info will come from the dev_tasks table BUT i want to dedicate on column of the displayed info for the latest log made to the task_history table.

The common column to both tables is the 'taskid' column.

What would the query look like to pull the info from both tables, knowing that the taskid is common to both and that I want to display the last log per tasks from the task_history table?

View Replies !
Trying To Pull Id, Count And Title But Lose Rows When I Add Extra Join
i'm trying to extract some information from my database, the query being

PHP

SELECT grps_c.catid, grps_c.title, COUNT(grps.groupid) AS COUNT
            FROM grps
            RIGHT JOIN grps_category grps_c ON (grps_c.catid = grps.catid)
            GROUP BY grps_c.catid
            ORDER BY grps_c.title

which works fine. however some of the groups (grps.groupid) are hidden and i don't want to count them, so my thinking was add

PHP

LEFT JOIN grps_setting grps_s ON (grps_s.groupid = grps.groupid AND grps_s.hidden_group != &#391;')

however adding that removes the rows that have a 'count' or NULL or Zero.

View Replies !
Max Amount &
i have a table of salaries that includes year, salary and id of employee.
what i want is an output of who was the highest paid employee for each year.
how in the world do i approach this? i've attempted some queries from the manual section 3.6.4 but have come up extremely short.
i get results where the employee id does not match the employee who was the highest paid for that year.

View Replies !
Certain Amount
How would you have a user that can only make a certain amount of databases? Oh i'm running MySql vr 4.0.24

View Replies !
How To - Select Uid Where Max(amount)?
I'm trying to do - select the 'uid' which has the highest 'amount' from bids table with link_id = 155.

Code:

select uid
from bids
where link_id = 155
having max(amount)

View Replies !
Variable Amount
i'm developping a php-application that needs to be highly customizable. On the one side, the user has a input-mask, where he can edit database records. on the other side, the user should be given the possibility to alter this database mask on his own, probably in a special "settings tab" - e.g. adding or deleting fields.

My approach so far:
I have to tables:
one, which holds the names of the fields to be offered AND
another one, which holds the entries for each "record".

These two are linked together by a "right-join" statement.

View Replies !
Certain Amount Of Rows
guess it is a simple question. let's assume i have a certain amount of rows in my resultset, sorted by their id. but actually i would like to retreive only a part of it, let's say the first time the first 20 rows, next time the next 20 rows and so on. think of a forum where you would see a maximum of 20 replies at once in the same thread. below you would have a forward/backward button which would let you flip through the pages with the answers, 20 each.

how would such an sql-statement look like?

p.s.: one solution would be to retreive e.g. all answers, and just to read out the needed ones from the resultset - but I guess there is a more sophisticated way, which would need less sources

View Replies !
Amount Of Columns
Does the amount of columns in a table matter? My member table has around 30 different columns and i'm wondering whether this is too much.

View Replies !
ORDER BY :: Amount
The following query does not seem to order by "bid_amount". It will simply take the first entry in the database.

Any idea how to make it order by "bid_amount" (DESC)? ......

View Replies !
Amount Of Records?
Any rough limit on how many records a MySQL database can work with?

I have a fairly large project - millions of records.

View Replies !
Creat Mysql In Unix And Pull/post Data From A WindowsXP Machine With A UserDSN?
Can I creat mysql in Unix and pull/post data from a windowsXP machine with a UserDSN?

Is there an Administrative Tool (User DSN) that I can utilize to pull/post data to a Unix account without having to through the long process of "FTP" and "XTerm windows" ?

View Replies !
Display Amount/No Duplicates
How do you select only the first #(10, 20 ,30... just some set number) rows in a table. Then if you want to continue, how can you select the next ten. I already know how to set them to display in desc order... but I don't know if adding this code will change it. In case you want to know, I am trying to make a news table and have it display on my web page, but I only want 10 headlines to display at a time, then click a link and the next ten will display.

The other question is: How do you test to see if someone has already entered the data you are about to enter. An example would be, if someone entered the data(aa,bb,cc,dd) then tried to enter that exact same data again, it would not allow it.

View Replies !
Percentages And Dollar Amount
what is the best practice for using percentages and dollar amounts? I'm setting up my schema. I will have percentages and revenue to enter into the database. What happens if I have 33% how should this be reprecented .

View Replies !
Storing Dollar Amount With .00
I want to save dollar amounts with two zeros at the end ($5.00). I have used the decimal type and it works if I have numbers at the end ($5.25) but it will not keep zeros. I need this because I want the info to display with two zeros. I saw somewhere about using a FORMAT option, but I can't seem to find in the Manual how to do this.

View Replies !
Variable Amount Of Data
I'm very new to MySQL. I've searched and searched and have been unable to find an answer to my problem. I'm setting up a database that will store photos (not the actual photo but the path) and the names of the people in the photos. I plan on two tables:

1) People
* ID
* fname
* mname
* lname

2) Picture
* People
* Location
* Date

I cannot figure out how to handle photos that have multiple people in them. The number of people could vary from 1 to 100. How do I create a table where each entry will have a varying number of people listed?

View Replies !
Limits On Amount Of Records
How many records can mysql handle? If i had a users table could I hold 100,000 users (records)? Where can I find the limits for MYSQL?

View Replies !
Displaying Certain Amount Of Data
I have created a script. This script of mine takes data off of a table and displays it on a web page. What I want is for the script to display only data that matches the id of another section of the web page.

For example, the script would first point to another factor in the database, perhaps the value of a row in another table. Let's call that value 025. In a second table, I have a few rows of data. Their ids were 025, 026, 027 and 028.

The web page would only display rows with the ids of 025. However, if that value in the other table was 026, then in the second table, the rows with id 026 would only be displayed.

View Replies !
Select Certain Amount Of Characters
Is it possible to select a certain amount of characters from a database?

So my database may have

"this is what is in the database"

But i want to select only

"this is what is in "

View Replies !
Limiting Amount Of Returned Rows?
How do I limit the amount of returned rows?

Lets say, that I want only the latest 400 rows (of e.g. 4034634 rows) -
is there a parameter for that like rownum in Oracle?

e.g. select * from someplace where rownum < 400 order by sometimefield?

View Replies !
Limit Amount Of Rows In Table?
I would like to have a table which only holds the last 50 added rows.
Table: userips

id, userip

4, 22.22.22.22
5, 23.22.22.25
6, 25.22.22.26
|
53, 22.55.55.112

Now if a new ip is INSERTed the last one has to be removed so only 50 rows will be stored at all time.I can do this by first inserting a new ip and then deleting a row which requires 2 query's but is there a more efficient way?

View Replies !
Higher The Amount Of Records Limit
What setting should I add/change in my.cnf in order to higher the records that are added I would like it over 80k.

View Replies !
Query For A Specific Amount Of Time...
I was wondering if there was some possible way to display a mqsql query for an exact ammount of time?

View Replies !
LIMIT And The Potential Amount Of Results
I want to know how many results I WOULD have had if I didn't set a limit.

SELECT SQL_CALC_FOUND_ROWS * FROM tablename LIMIT 0,5;
SELECT FOUND_ROWS();

View Replies !
Design Tabel With A Max. Amount Of Records
Is it possible to design a table with a max. of 150 records, or is this something to i need to solve with php?

View Replies !
Limit The Amount Of Words To Display
I have the following script:

PHP Code:

$pressq = mysql_query
    ("SELECT Photo, Title, Synopsis, Filename, Brand, Date, RaceProd
    FROM PressRelease
    WHERE Brand='this'
    ORDER BY Date DESC
    LIMIT 5"
    );

I'd like to limit the number of words in the Synopsis to display only the first 25 words. How do I change the script to reflect that? Right now the 'LIMIT 5' limits the results to a listing of 5 results.

View Replies !
Inserting Huge Amount Of Data In DB
I've got a script that scan .csv files and have to add data in a DB. I've try to save data into array and only insert data at the end in one shot, but I got memory problem.

I would like to know the best way to add about 1 million of data in DB. Do I go with one query per data? Do I try to say cumulate like 100 data and then insert them and repeat this until it is done?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved