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.





Virtual Column


I want to get users informations from multiple tables and each user has many dependants (in tbl_dependants) and the dependants table has user_id foriegn key. Is it possible to SELECT user informations and beside the user results I create a virtual column contains dependants names for each user?¿?




View Complete Forum Thread with Replies

Related Forum Messages:
Using Virtual Column In WHERE Clause
SELECT IF( some_id > 3, 'foo', 'bar' ) AS 'virtualcolumn' FROM table WHERE virtualcolumn = 'foo'

MySQL will complain that 'virtualcolumn' is unknow in WHERE clause.


However, if I have another query like

SELECT IF( some_id > 3, 'foo', 'bar' ) AS 'virtualcolumn' FROM table ORDER BY virtualcolumn ASC .

View Replies !
Virtual Domain
I have a dedicated server with 5 virtual domains under iis.
i just installed mysql. how do i create a separate instance of mysql for
each of my virtual domain so that one domain affects only tables created by
that domain and not step on tables of other domain?
let's say that each virtual domain is a separate web site with different
fqdn

View Replies !
Virtual Fields
Is there a way to do a mysql select with - for lack of a better word - a 'virtual field'. In other words, I'd like to select on a field that is based on the contents of other fields. Like:
If field A is greater than field B, select field A, otherwise select field B
Specifically, I'm working with date fields. I have a table of events where there is a start date and an end date. Most events are one day only, so they have only the start date. I would like to select and sort on the latest date field - either the end date or, if there isn't one, the start date.

View Replies !
Db On A Virtual Web Server
i am running my web server with dsvr.co.uk. a uk based web server hosting company. I am trying to use a piece of software called smoothflash at the moment to show pics. dsvr have informed me that I have mysql on my server but i cannot for the life of me work out how to connect to a db, een to create a new db. www.smoothflash.com has the install manual on it and it all seems to straight forward. I know I have enabled mysql on my server, this has been varified by dsvr. but then I have no idea how I am meant to create a db, connect to it, i have mysql admin for windows but without knowing how to create a db, get a user name and password for it i have no idea how to get any further, if any of you clever people out there could help me in this matter i'd forever be in your debt.

View Replies !
Virtual Folder
in my database i have a table which stores a directory structure

folderstructure table
id, foldername, parentid

parentid points to its parents "id" (:p )
i need to retrieve this info so that its sorted by foldername and its children are listed below also sorted by foldername; there can be a infinite amount of nested folders.... im not really sure how to go about this; i was hoping that maybe theres some magical sql statement that can do this for me
i sort of dont want to put this info in a array then sort it with recursion (which i tried and failed), nor do i want loads of sql queries

View Replies !
Mysql To Virtual Domain
I have a dedicated server with 5 virtual domains under iis.

i just installed mysql. how do i create a separate instance of mysql for
each of my virtual domain so that one domain affects only tables created by
that domain and not step on tables of other domain?

let's say that each virtual domain is a separate web site with different
fqdn

View Replies !
Not Working With Virtual Host
I set up a virtual host with Apache and my previously-working MySQL configuration now will not work! I did this a long time ago and can't remember how to fix the problem...Do i need to change some configuration so that MySQL runs on the virtual host and not localhost?

View Replies !
MySQL Virtual Hosting
When you create a new user, let's call him "userJohn", is it possible to set a different data foler for that user?

I was thinking it would be great if you could keep user databases seperate from each other, kind of like every user has thier own folder on a virtual database folder, and access can be restricted for that user to the databases in their folder.

So if user1 creates a database named "Database1", and later user2 creates a database with the same exact name, it will not give an error, and when user1 alters his "Database1," it will not effect any other users "Database1". Similair to webhosting, where every user has their own folder they keep thier data in.

View Replies !
Chew So Much Virtual Memory On Windows?
Have a fairly busy MySQL server using MyISAM and InnoDB tables on Win 2003 with plenty of available RAM (total 4GB, with about 1.5GB unused) which is using a massive amount of virtual memory despite having tweaked MySQL to use as much memory as it needs. RAM usage never gets much above 400MB, however Windows is reporting that MySQL is using a massive 1.5GB of virtual memory.

Most other processes use a similar amount of RAM and virtual memory, so why would MySQL be using 4~5 times more virtual memory than physical memory? Especially when there is so much free physical memory?

View Replies !
MySQL VmWare Virtual Machine - Password?
I just downloaded and installed the MySQL-provided VMware linux virtual machine. To logon to it there is a linux user 'lxuser' provided. Anyone know the password for lxuser? root?

View Replies !
Create Virtual Table During Query Or Load Table To Memory From Text File
I have access to my application database via a secure link, so I cannot link a local database to it, only run queries on the remote server and download the result.

The database is missing some useful information, and I cannot add a table at this stage. I would like to achieve the result by creating a virtual table or the like. ...

View Replies !
How To Refer To A Virtual Table Created By Sub-query In Other Sub-query?
how to refer to a virtual table created by sub-query in other sub-query?

like this:

select ... FROM (select....) as C where xyz=(select ...from C) ..;

it returned error table C does not exist

View Replies !
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 !
Killing One Virtual Console Process From Another (IE, Killing Console Session ALT-F1 From ALT-F4)
On the subject of switching between virtual consoles to get
out of a 'hung' situation in the primary console...

What I have been doing is pressing LEFTALT-F4 to bring up
a 2nd virtual console, logging in as root and running poweroff
to close EVERYTHING down. All I really wanna do is terminate
the hung console session. Can I do that from the 2nd virtual
console without having to power down & reboot linux? Code:

View Replies !
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 !
Selecting Records, Then Summing Parts Of A Column, Then Sorting By That Column...
I’m keeping track of baseball stats, and each row represents one line of stats (from a box score) for one player of a single game. Because of this, a single player may have multiple rows in the table. I want to cumulate each player’s stats (so they’ll be one row per player) and display as output, which isn’t a problem. Then I want sort by a certain stat, but by now I’ve already looped through the table, so I can’t sort using a mySQL query at this point. I tried first putting values into an array in a previous project, but that became extremely complicated. What’s the best way to approach this?

View Replies !
A Date Column That Auto-updates When Any Column In The Row Is Updated
Let's say I have a table with several columns.

I would like to add a column called "date last updated".

How this would work is that any time one of the other columns in that row was updated, the 'date last updated' column would update.

I *know* how to do this with PHP, but here is the special part...

Is there a way to have this automatically just within MySQL, so that EVEN IF if update a column manually through the command line or PHPmyAdmin, the 'date last updated' field updates.

View Replies !
Select One Column Unless A Condition Is Present In Another Column
I have one entry for public IP and one for private IP. Public IP is not null by default, but private IP is. I would like to select all public IP, unless there is a private IP, then I will select private IP instead. Is it possible to do it?

View Replies !
Extract 5 Digit Column Data Into Another Column
i would like to make an update on my tables, which extract out the zip code from an address column into another new column call zipcode... coz the previous design of the table doesn't have this column.

View Replies !
Update Part Of Column Into Another Column
I'm looking for a way to update a SQL column with a portion of info from another column in the same table.

example of a sql command
--------------------------
UPDATE table1
SET table1.columnname1 = table1.columnname2
FROM table
WHERE blah blah blah

Here's the thing... I only need a portion of the data found in the source column. I'm not sure how I would do this then.

for example, the database has countries and states combined into one column like this 'US-DC', 'US-CA', US-FL', etc. I want to separate these into two columns, a country column and a state column.... and I dont want to go though all the results and do this line by line. How would I write the SQL command so that it puts just the country in the country column, and puts just the state in the state column, and it omits the dash all together.

any ideas?

View Replies !
Differentiate Between Column Alias And Other Column With Same Name
Sample SQL:
SELECT
a,
(SELECT a + 3) AS b,
(SELECT y FROM t2 WHERE b = b)
FROM t1

1. SELECT a + 3 will calculate a column with alias b
2. t2 has a column named b

Question: How can I differentiate between column alias b and t2.b. MySql treats alias b as t2.b in statement (SELECT y FROM t2 WHERE b = b)

View Replies !
Order By On Column And Reoder By Another Column
im using php and mysql, but i would like from the sql statement to get the results of a query order by a column and then reorder by another column that is:

i want to select the last four entries accoding to the date.
SELECT * FROM table ORDER BY Date DESC LIMIT 4

but I also want to order those 4 entries i got, according to their values at the order column like this

SELECT * FROM table ORDER BY ordercol ASC LIMIT 4

how can i put this two together?

i thougt of
SELECT * FROM table ORDER BY Date DESC, ordercol ASC LIMIT 4

but it gets the last four entries and then if two entries have the same date it orders them according to the ordercol, how can it do it?

View Replies !
Using Table A Column Row Data For Table B Column Headings
Is it possible to add column data in table A and have (dynamically linked) table B column headers?

View Replies !
Re-name A Column
I am using Query Browser version 1.1.2, MySQL Administrator 1.0.14, MySQL
Version 4.1.7-nt on Windows XP Service Pack 2

ALTER TABLE `purpleflavours`.`purchaseorderitem` CHANGE COLUMN
`PurchaseCost` `PurchaseOrderItemCost` DOUBLE UNSIGNED ZEROFILL CHARACTER
SET NULL COLLATE NULL NOT NULL DEFAULT 0000000000000000000000

Generates when I click the apply changes button in the MySQL Table editor
window after changing the column name.
This generates an error telling me I have an error in my SQL Syntax

Can anyone tell me what is wrong?
By the way I can use the table editor to change VarChar column names with no
problem but I always get a syntax error if the column type is not a VarChar,
i.e. Double, DateTime, MediumBlob, Integer etc.

View Replies !
As Column
I have a query that selects... YEAR(date) as theyear
But I get an error every time I try to use 'theyear' in my WHERE clause...
It just says 'Unkown column "theyear"'

View Replies !
Column Value
I made this query which has this sum fuction which calculates the value of the contents of the individual rows.
e.g

SELECT (SUM(case when R1='yes' then 1 else 0 end) +
SUM(case when R2='yes' then 1 else 0 end) +
SUM(case when R3='yes' then 1 else 0 end) ) AS yes,
(SUM(case when R1='no' then 1 else 0 end) +
SUM(case when R2='no' then 1 else 0 end) +
SUM(case when R3='no' then 1 else 0 end) ) AS no
FROM tblname1
where faculty_name = 'abc'
AND student_name = 'efg;

i want to display the values of the faculty_name and the student _name and one other column (comments) . but it shows error. i tried doing union but its not working either

View Replies !
Where Column
I initially thought when doing a query with a where clause that has WHERE something='value'

that it would look for exact value.

but when I ran a query like this:

"SELECT * FROM table where id='65'or id='64'

it brings back the row where id=65

(id is column type: id INT(5) NOT NULL auto_increment)

(I was testing some queries to verify user input and its results in php)

View Replies !
SUM(column)
I trying to add a column where the field is equal to 0'
I try something like this but does not work

SUM(IF(pitcherstats.win = 0)) AS loose,

View Replies !
Associated Column
Consider the following dataset:

ID / Category
1 / 1
2 / 1
2 / 2
3 / 2

If I SELECT where Category = 1 or Category = 2, I will get two results.
What would be the correct way to accomplish obtaining only the IDs which contain BOTH Category 1 and 2 (In this example, ID 2)?? -- Basically a boolean 'AND' search of some sort... saying 'SELECT * .. WHERE Category = 1 AND Category = 2' obviously doesn't work.




View Replies !
Name Of A Column
how can i find the name of a column using mysqli?

View Replies !
Getting The Last Row For Each Value In A Column
Getting the last row for each value in a column .....

View Replies !
Set Column Value
i have 2 colmuns that i want to use the difference between
them as the value of another column.
all columns are in the same table.
the type of the 2 column is "Date".
so what i want is to get the difference between the 2 dates and assign it to the 3rd
column.

View Replies !
Row Into Column
i have this structure of tables:

tehnic_detalis(id_detail, detail_name)
products(id_product, id_detail, detail_value)

I wish is to transpose row from tehnic_detalis into column for products in something like this short_description(id_product, detail_name1, detail_name2...)

View Replies !
Column Name Containing . (dot)
I have a query that contains some column names with a dot (.) as part of the column name. How can I select these columns in another query?
Example: The first column is 'Name', the second 'Name.Old'
Now:
SELECT * FROM (qryName) works fine.
SELECT Name FROM (qryName) works fine.
SELECT Name, Name.Old FROM (qryName) does NOT work.

View Replies !
Can You Add A Column?
Is it possible in a SQL query to have it select all entries for one coloumn and add them together? instead of looping?

View Replies !
Column = Column + 0
Is column = column + 0 allowed as part of a MySQL query?

I am experiencing problems using it, but I can't be sure if it is that or something else in the code..

View Replies !
Add New Column
I Want To Add New Colume In Exitsing Table Which Have 3000 Records New Columns Not Contain Null Values
How To Add Then Not Null Column In Exitsing Table

View Replies !
Cannot Change Column Name
I inadvertantly named a field "in"

mysql> select * from guestbook;
+----+-------+-------+-----------------+----------------+
| id | fname | lname | comments | in |
+----+-------+-------+-----------------+----------------+
| 1 | Mick | White | Test 123 | 20050208000000 |
| 2 | Ann | White | Hello World | 20050213101948 |
| 3 | | | It's a nice day | 20050213102405 |
+----+-------+-------+-----------------+----------------+
mysql> select in from guestbook;
ERROR 1064: You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'in from guestbook' at line 1

But I can't seem to be able to change it:
mysql> alter guestbook change in time_in;
ERROR 1064: You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'guestbook change in time_in' at line 1

The table:
mysql> desc guestbook;
+----------+-----------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-----------------+------+-----+---------+----------------+
| id | int(4) unsigned | | PRI | NULL | auto_increment |
| fname | varchar(10) | | PRI | | |
| lname | varchar(10) | | | | |
| comments | text | | | | |
| in | timestamp(14) | YES | | NULL | |
+----------+-----------------+------+-----+---------+----------------+

View Replies !
Auto Column
I want to select a single row called "row1" but let mysql auto
append a NON-exist column call "row2" of it. And i want that non-exist
column be auto-increment. how to?


If i "select row1 from mytable", then i get

-----------
- row1 -
-----------
- a -
- b -
- c -
- d -
-----------

but i want:
----------------------
- row1 -- row1 -
----------------------
- a - 1 -
- b - 2 -
- c - 3 -
- d - 4 -
----------------------

View Replies !
Best Practice Column
Is there an accepted best practice on whether to store
decimal currency amounts (e.g. dollars and cents) in MySQL
decimal column types?

Certainly, the most straightforward way is to use decimal
columns. But it appears that such values are stored as
ASCII strings, which would be inefficient for calculations
(requiring conversion to a numeric type for each
calculation).

I guess the alternative would be to use integer columns
(and multiply by 100 to store the value as total cents).

My particular context is a PHP/MySQL sales system.sie.nctu.edu.tw

View Replies !
Column Default Value
How may I change the default value of
an existing table?
(type will remain the same)

View Replies !
Updated Column?
is there a way to obtain only the affected columns after an update query? After an update query, that involves 10 columns, I know that only 2 columns are really updated (because the values of the other cols don't change). I need to know the names of that changed cols, for logging purpose.

View Replies !
Column Privilege
I am having problems granting column privileges. I want to grant the
update privilege (only) to a column (called pass) in a table (called
Acct). Here's what I get:

mysql> grant update pass on practicedb.Acct to JohnDoe@localhost;
ERROR 1064: You have an error in your SQL syntax near 'pass on
practicedb.Acct to JohnDoe@localhost' at line 1

I don't understand how the syntax is wrong. I think I followed the
instructions in the manual. I don't have any problems granting table
privileges--just column.

View Replies !
Column Heading
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 !
Add A Column To Get A Total
I need to know how to add a column of numbers and get a total using my sql command.

SELECT v.vid, title, purchdate, sum(cost) AS Total
FROM Video v, Vidcopy vc
WHERE vid.v = vid.vc

I need to know how to add the cost column and get a total.

View Replies !
Un-UNIQUE'ing A Column
How do I do this? I accidentally set a column as UNIQUE and I don't
need it set that way. How can I set it back to not unique?

View Replies !
Use An Array Column
I am building a photo album webpage and am not sure exactly how I
should organize the database. Here's where Im at so far...

I have one table called 'images' which contains the columns
'id','albumID', 'url', 'title', and 'description'.

Then another table called 'albums' which contains the columns 'id' and
'name'.

The part where I am having the trouble is the 'images.albumID' column.
Some photos can be apart of mutliple albums, so should the 'albumID'
column be an array type?

View Replies !
When To Use An Array Column?
I am building a photo album webpage and am not sure exactly how I
should organize the database. Here's where Im at so far...

I have one table called 'images' which contains the columns
'id','albumID', 'url', 'title', and 'description'.

Then another table called 'albums' which contains the columns 'id' and
'name'.

The part where I am having the trouble is the 'images.albumID' column.
Some photos can be apart of mutliple albums, so should the 'albumID'
column be an array type?

View Replies !
First Blank Row In A Column
How do you get the first blank row in a column.
I have tried
select * from table where column = '';
but this is not working.

View Replies !
How Do You Get The First Blank Row In A Column.
How do you get the first blank row in a column.
I have tried
select * from table where column = '';
but this is not working.

View Replies !

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