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.





Display Column


i'm a beginer to PHP and MySql and I was woundering if I could display all of the different values in a table column without show dupelicates. One examle of what im try to achieve is

ID | ARTIST_NAME | ALBUM_NAME | TRACK_NAME

now lets assume that I have registered 10 albums into my database each with 10 tracks. If I try to display the different album names, I would get one album name followed by 9 dupes. Is there a way of just showing 1?
(note in the real database not all album have 10 tracks so a script that takes away 9 would not work!)




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Display A Particular Column
how to display a particular column from a row in PHP.

Like this.
<table>
<tr>
<td>column 1</td>
<td>column 2</td>
</tr>
</table>

View Replies !   View Related
Display Result As Column
Say I have a table with column (A B C) with C a direct mapping to B
I want to group column A as UserID and display the result of B as the column name itself with column C as the result of these Columns.
Something like
UserID | B.result1 | B.result2 | etc
1 | c.1 | c.2

Does anyone have any suggestions on how to do this ?

View Replies !   View Related
Display Results From A Column In A Row
I am using php/MySQL 4.0 .. tried using GROUP_CONCAT, but it would not work ... perhaps not supported in MySQL 4.0?

If I had a table consisting of:

player l code l amount
-------------------------------------
playerA l 1 l 5
playerA l 2 l 6
playerA l 3 l 4
playerB l 5 l 10
playerC l 3 l 4
playerC l 4 l 3

SELECT player, code, SUM(amount) as amt FROM table GROUP BY player

How would I get the result below?

playerA 1,2,3 15
playerB 5 10
playerC 3,4 7

View Replies !   View Related
Display Result From Query In More Then 1 Column
I want to make a query to a database, and display it on my php page either through php code or with 2 queries to my mysql database.

This is how i want it displayed:

Data 1 Data 2
Data 3 Data 4
Data 5 Data 6
Data 7 Data 8
... ....
Data X Data X


This is my current code which i use and get it displayed in 1 row:

View Replies !   View Related
How To Dispaly Column Heading After Every 15 Records Display
By default Mysql select statement displays column names header only once at the first row.

I want the column names for the select statment to be displayed after every say 15 rows of display. ( This is very much equal to set line size 15 in oracle) .....

View Replies !   View Related
SELECT Multiple Columns As One Column For Display
I did a search and could not find what I was looking for. Hopefully someone can answer this.
I am trying to SELECT multiple columns as one column for display. Something like this (which obviously does not work):

SELECT column1 as combinedlist, column2 as combinedlist FROM `myTable` WHERE column1='data1' OR column2='data1' ORDER BY combinedlist

I have also tried:

SELECT (column1, column2) as combinedlist FROM `myTable` WHERE column1='data1' OR column2='data1' ORDER BY combinedlist

View Replies !   View Related
Force Display Of Column Names For Empty Result Set?
I often use commands like this to create tab-separated text files from my tables:

mysql -e "select * from mydb.mytable;" > myfile.txt

This usually works great, but I'm having trouble when the query returns an empty set. In this case, I would like myfile.txt to end up with a header row with the column names, and then no additional rows. Instead, I'm getting a completely empty file. This is similar to the fact that if you run a query in mysql like "select * from mydb.mytable where 0;" you get the response "Empty set" instead of a table with a header and no rows.

Anyway, this is causing me a lot of problems, because I would like to pass these text files off to another program, which is happy to work with text files with headers and no additional rows, but is not happy with completely empty files.

I have tried the "--column-names" option on the command line, but it doesn't help. Is there any way to force mysql to display column names, even for an empty result set?

View Replies !   View Related
Can I: Export Column, Optimize & Fill New Column With Value To Original Column?
I have a database with over 40,000 rows and 28 columns (learned how to import large files by changing php.ini!).

Using Excel, I am able to: (A) copy and paste original column (e.g., SIZE_TEXT) (B) ALONG with each records' UNIQUE_KEY, (C) sort SIZE_TEXT column, (D) filter for unique values, (E) fill new column with its SIZE_TEXT__KEY, and then (F) import the new SIZE_TEXT_KEY value into the database by creating a new column or pasting over the columns original value.

However, I think this can be performed, with less potential for error, using phpMyAdmin, but I haven't found anything demonstrating how to perform these actions.

I searched the terms optimization and normalization.

I am hoping one can use phpMyAdmin to:

1) create a new table with export column of the original table (SIZE_TEXT_TABLE),
2) sort new table for duplicates and show only unique values, then
3) import the column results into each Unique Records original column (SIZE_TEXT)
4) link new column values to Foreign Key (the Parent Table's SIZE_TEXT_KEY)

View Replies !   View Related
Selecting From Column A Where Column B Matches Column A Twice?
Here's a table called Creatures containing Creatures and EntryIDs:

Code:
[Creatures]
Creature EntryID
==================
fish 100
cat 100
fish 200
bird 200
pig 300
bird 400
I would like to select all EntryIDs that contain both "fish" and "bird".

From the above table, "200" should be returned, seeing as both fish and bird are the only rows that both use the same EntryID.

How can I do this? Do I need to use Group By or Left Join or something?

View Replies !   View Related
Display
SELECT t1.*
FROM tbl_data AS t1
INNER JOIN (
SELECT t2.lastname, t2.firstname, COUNT(*) AS cnt
FROM tbl_data AS t2
GROUP BY t2.lastname, t2.firstname
HAVING cnt > 1 ) AS t2 ON ( t2.lastname = t1.lastname AND t2.firstname = t1.firstname)


This is my recordset that displays all my database records. How can I change it so it only displays lastname that starts with the letter A. That is, I want only the rows that contain last names like Adams, Anderson, Appison, etc.

View Replies !   View Related
Display Particular ID First
I have a products table with a primary "id" field. One of my products id=27 needs to be displayed first then ORDER BY name DESC.

Is there a way to do this via the query - I know how to do it with PHP but would like to find a simple mysql alternative.

View Replies !   View Related
Display Mysql
I'm trying to display a mysql varchar field that include address. Address is in multiple line. But I don't know how I can display this field exactly as entered(ie, in multiple lines). Whenever I'm trying to display the address, it's displaying in a single line..

View Replies !   View Related
Display Records
i just want to know if for example i have a database with a table and some records in it, can i display those records in the database using xml without using php

View Replies !   View Related
Not Display Last Record
How do I display all the records but not the last inserted one?
Is there a MySQL statement I need to do this

View Replies !   View Related
Display ERD Diagrams
I am way to used to microsoft's enterprise manager and the erd diagrams that it allows a person to view. I have been looking for a program that will allow for the same functionality in mysql. In other posts I have found one that is supposed to do what I want (DBDesigner), but for some reason it always says that my login is incorrect, which is the same one that I use for mysql-admin, so I dropped that one after a number of attempts.
Is there any other programs out there that provides what I want? Obviously if it is free that is good, but if there is a program that is around a $100 and provides a demo version to let me preview what I am to pay for, that is ok as well.

View Replies !   View Related
Display Components
I am having a little trouble with a group by query:
Code:

SELECT Names.name, SUM(cost)
FROM Names, Costs
WHERE Names.nameID = Costs.nameID
GROUP BY Names.name

This gives me the cost totalled by name, what i would actually like to show is every individual cost item by name, and the totalled amount for that name at the end. Obviously to just return all individual costs per name the query would be:

Code:

SELECT Names.name, Costs.cost
FROM Names, Costs
WHERE Names.nameID = Costs.nameID

I can not successfully draw the required results in one query.I am using mysql 3.23.54.


View Replies !   View Related
Maximum Display
What is the benefit of specifying a maximum display width after a int, tinyint, bigint etc.
For example if I specify a column as int(10), the column will still take 4 bytes of storage data. So what is the use of specifying (10), the Maximum Display Width.

View Replies !   View Related
DISPLAY NUMBERS
HOW CAN I DISPLAY NUMBERS LIKE 123,456.00 IN MYSQL?

Actually in phpmyadmin.

when i choose decimal or double i can get two zeros ( like anynumber.00)

what i wan to see is ###,###.00

View Replies !   View Related
Display FOREIGN KEY
here are the codes below
<?php
include "opendb.php";

$query = "SHOW CREATE TABLE cclp_teams";
$result = mysql_query($query) or die(mysql_error());

echo "<br>";
echo $result;
echo "<br>";

?>

But my codes has problem.
It says --> Resource id #3

What is wrong with my codes? what function do i need to display the structure of the tables?

View Replies !   View Related
If X = 1, Display Record
How would I display a record only if a certain column in the table has "1" in the row? Things should automatically submit at 0.

This may sound complicated, and if there's an easier way that'd be great. What I'm trying to do it have people submit something, but it needs to be approved by me, the webmaster. I don't want records to be automatically displayed upon submission. If there's an easier way that manually entering "1" into a column in the table, that'd be great.

View Replies !   View Related
Display Date
i have used prepared statement to insert date values in database..it is inserting..but the prob.. is that it cannot display date in dd-MON-yy format.i.e 26-jan-04

my query is like that:

java.util.Date dt1 = sdf.parse(request.getParameter("chq_date"));//inserts in database

pstmt.setDate(1, new java.sql.Date(dt1.getTime()));

<td><input value="<%= rs.getDate("chq_date") %>" name="chq_date"></td>//displays date

View Replies !   View Related
Display Related Value
I'm displaying personnel actions data in a details page based on the ID of the personnel action record, but would like to display a value (Employee Name) from a related table (tblemployees) based on a payroll_num field in the details page. These two fields are related, payroll_num and payrollID(primary in tblemployees). How do I add both tables in my query or is this the right way to get this accomplished?

View Replies !   View Related
Display FOREIGN KEY?
I want to know the structure of the table. I want to see the FOREIGN KEY, if it has index?, primary key? etc.

View Replies !   View Related
Display X Out Of Y Entries
I have a MySQL DB with ~1100 entries, 13 Fields per entry.
I have a search feature on the page, but when someone searches, they get all of the matches at one shot. What I would like to do is display, say 5 matches, at a time. Then have a next and previous at the bottom of the page along with page numbers.

View Replies !   View Related
Unable To Display More Than 25 Records
I'm using PHP 4.3.10, and MySQL 4.0.26, and cannot seem to get my script to return/display more than 25 records:

<?php
$query = "SELECT company_name, company_phone FROM tbl_company
ORDER BY company_name LIMIT 40 ;";
$result = mysql_query($query, $db); //note $db connection already
established
for ($i=0; $i < $totalRows; $i++)
{
$row = mysql_fetch_assoc($result);
echo "...";// show info here etc.
} ?>

When I use PHPMyAdmin and run the above SQL statement direct, it returns all 40 records. However when running on the host server, my script is generating and displaying only the first 25 records on my website.

View Replies !   View Related
Display A Text In A SELECT
I want to do the following query, or something like that:

SELECT id, "string"+id as text FROM ...

and the result should be:

id text
1 string1
2 string2
3 string3
... . ... for each id returned by the query

It looks stupid but I can't figure which operator (I tried '+', '.',
'|', '&') I can use for this purpose.

View Replies !   View Related
Display A Text In A SELECT
I want to do the following query, or something like that:

SELECT id, "string"+id as text FROM ...

and the result should be:

id text
1 string1
2 string2
3 string3
... . ... for each id returned by the query

It looks stupid but I can't figure which operator (I tried '+', '.',
'|', '&') I can use for this purpose.

View Replies !   View Related
Horizontal Display Of Records
consider a table employee with fields empid, ename and department ....

View Replies !   View Related
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 !   View Related
Display 1.0720000000002e+015 To 1072000000000189

I have a field with NOPERDIM varchar(20) the content is Like this 1072000000000188

I want to select max(noperdim) +1, but the sql result is 1.0720000000002e+015

How do i can select max(noperdim) +1 with displaying complete number 1072000000000189

View Replies !   View Related
Display 4 Most Recent Rows
I need to display the next 4 upcoming events (from the current date) in our events database...

SELECT * FROM events WHERE eventdate ??? LIMIT 4

View Replies !   View Related
Display Data Per Page
I have a search form which displays data depending on the user input. User can perform search based on certain ocupation and certain gender.
After performing the appropiate 'select' statement, if, for example, you know there are 100 rows retrieved. How would you display these data over 10 different pages? eg: clicking on the search button will display the first 10 rows of data, then clicking on the 'Next Page' button will display the next 10 and so on

View Replies !   View Related
Display Root Level
I need to write a pl/sql procedure which takes in the parent data of a hierarchial tree as input parameter and displays the root of the hierarchial tree. For eg. 'A' is the parent and the second level is 'A-1', 'A-2' and 'A-3'. 'A-1' has got another child, 'A-1-1' and 'A-1-2'.
'A-2' has got another child, 'A-2-1'. And 'A-3' has got no child. So, by giving the input parameter as A, the output I should get is 'A-1-1', 'A-1-2', 'A-2' and 'A-3'.
A
/ |
A-1 A-2 A-3
/
A-1-1,A-1-2 A-2-1

View Replies !   View Related
MySQL Query Display
Have anybody ever see this display problem, my "SELECT * FROM..." is blur, why is that?

The chipset I'm using is Intel 855GME with Integrated 3D AGP featuring Intel Extreme 2

View Replies !   View Related
MySQL To Display Another Language
This may or may be a stupid question. I tried googling it but my question is too vague to find a answer. I have a mysql database I have been populating with content for about 2 years. Right now my MySQL server is using English as its character set and everything stored inside is english.

Now if I wanted my site to helpful Spanish speaking users, is there anyway I can have MySQL trasnalate the database into Spanish? So it'll be stored in English but when you retreive any data, it comes out spanish? Is this possible? If MySQL can not do this, does anyone have any suggestions on how I go about this? Do I find a language translater etc? I definetly dont want to be inputting English / Spanish for everything I enter into the database...that will be too time consuming and will involve me needing a spanish translator.

View Replies !   View Related
Display First Date Of The Month
Can any body help me in how to find out the first date of the month.

Eg:

Input:
12-Sep-2008

Ouput:
1-Sep-2008

View Replies !   View Related
Query To Display Duplicates?
I've looked online but haven't been able to find what I'm looking for. I just need a simple MySQL query to display all the records from a database if one of their fields (products_model) is being used by more than one record.

Something like...

ID products_name products_model
===========================
12 Product A 1345
237 Product G 1345
83 Product L 211
901 Product X 211
68 Product S 211

View Replies !   View Related
Unicode Character Display
i've converted by tables to unicode and I added a japanese word in japanese script (using phpMyadmin), it displays correctly on the page, although in the database it displays as:

&#24195 ; &#21578 ;& #26989; (I added spaces before the ; in this posting so that it displays the code and not the japanese symbol)

this is the way it should be? Or is it possible to read the japanese script in the database as well?

View Replies !   View Related
Utility To Display Relationships
Does anyone know of a utility that will create a visual representation of my db?
Access has a feature that kinda helps with this

View Replies !   View Related
Display DB Foreign Keys
If I have a table ,A, that have been link to other table. Is there any command that can show all the table link to the Table?

View Replies !   View Related
Display 8000 Records
I have 8000 records that I want to display, before I used to place the data in a table. But I found-out that i takes time to load all 8000 records to display.

Ive tried to display the 8000 records without a table and it displays really fast for about 4-5 seconds to display it all, but Its hard to arrange the data because of the allignments. I want to know if there is another way of displaying my 8000 data in about 4-5 seconds without using tables.

View Replies !   View Related
Display Numberic Value As Currency
I'm using MySQL 5.0, and phpMyAdmin for a company project database. One of the fields in my database is "Project Value" and I would like to have the value of this field be displayed as $20,000,000.00 instead of 20000000 and still be able to perform aggregate functions. Is this possible? What data type should this field be set to?

View Replies !   View Related
Formating A Display Of Numbers
Hi, I'm yellow in MySQL this is just the beginnig of my journey. And I've encountered a seriuse problem, or maybe a question for which a cannot find an answer :( and that makes me sad, really sad. So my problem is this: I want to display a number (result of POW(x,y) operation) with specified number od decimals. There is a function to do so (FORMAT(x,d)) but it requieres to specify "d" before sending query to server. But in my case I dont know it, and I wand "d" to be a result of another operation. But when I do so, error occures :( Is is possible to do my way, or is it just imposible because all rows must be formated in the same way?

View Replies !   View Related
Display Month As April Instead Of 4
I am trying to return the current month, by the month's actual name rather than the number of month.

SELECT MONTH(CURRENT_DATE);

I want to see April instead of 4. I was thinking I need to add DATE_FORMAT but I'm not sure what the syntax should be.

View Replies !   View Related
Screen Display Of Tables
Sometimes when I view a table using SELECT, the table columns are misaligned. For example, the | delimiter on the last column on the right appears to wrap. Is there a way to make a nice "pretty" tablular display on the screen?

View Replies !   View Related
Multiple Tables, One Display
Let's say I have three tables;

personid1
class1
date1

personid2
class2
date2

personid3
class3
date 3

I need to display the classes and dates on a page, with the person id =PID in a URL.

View Replies !   View Related
Long Text Display
I am kind of new to php/mysql, I am just now starting to learn some of the basics. I have a website that is dedicated to movies/musicals/plays reviews, and as of now it's not connected to any database, but eventually I would like the information to be stored in mySQL.....

View Replies !   View Related
Display Data From Another Table
I have a table that has the state depicted as a number and another table that has a list of state names and their number. I would like to retrieve the data from the first table but have the state displayed as the state name from the second table.

View Replies !   View Related
Display Categories And Subcategories
I have a table with all my categories and subcategories, with the following schema:

id_category | id_parent | name

1 | 0 | category#1
2 | 1 | subcategory#1
3 | 1 | subcategory#2
4 | 2 | subsubcategory#1
5 | 0 | category#2
5 | 5 | subcategory#3
...

All categories have id_parent = '0' and subdirectories have id_parent = the category or subcategory they belong to.

I want to do a simple query that displays categories and all it's nested subcategories in order.

Is it possible to do this with one query or must I make a loop to get them all?

View Replies !   View Related
Shuffle And Display Top X Rows
Using MySQL 4.1.10 with Coldfusion MX 6.1 on top.

A table of data gets regular inserts of hundreds of rows at a time in the same category. A categoryID field (foreign key) is assigned to each row. So the table consists of sequential blocks of data in each category--200 to 1,000 rows of category1 then 200 to 1,000 rows of category2, then some more category 1, and then some category3, etc.

I want to extract a small (and most recent) subset of the data using a select query in a way that shuffles and returns the top rows for each category like this:

Row1 Category1
Row1 Category2
Row1 Category3
Row2 Category1
Row2 Category2
Row2 Category3
Row3 Category1
Row3 Category2
Row3 Category3
Row4 Category1

This example returns 10 rows. I'd like that quantity to be dynamic so I can send the query a variable from CF. The quantity of categories is known (although does grow infrequently) so I can plug that in if necessary but I'm trying to get that quantity on the fly. That, of course, takes a simple count(*) function of the category table. I just can't figure out how to incorporate that with the rest of what is needed.

Am I the only one working this weekend? I think I'm close but I have a maze of nested loops and other CF goofiness and I'm still not there. Hoping to trash all that and find a purer database solution, if possible.

View Replies !   View Related

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