Interesting SQL Query Requirement For &<SELECT&> Menu
Nov 7, 2005
Hi All
Wondered if you could help me with the below query.
I have 1 simple table called STOCKCATS that consists of 2 fields.
These fields are called CATID and LEVEL.
The contents of this table are as follows:
CATID LEVEL
cat01 <nothing>
cat02 <nothing>
cat03 cat01
cat04 <nothing>
cat05 cat01
cat06 cat02
cat07 cat04
etc.. etc...
The way this table works is that I have an ASP page that allows the user to
create a stock category at 2 levels, category level and sub-category level.
When I file the entered data into the table, if the user has chosen to
create a category level stock category then the LEVEL field is left blank
and if they chose to create a sub-category level category then I post the
relevant category level stock category code in the LEVEL field. For
example, in the above list cat01 is a category level stock category and
cat05 is a sub-category as it is a sub-category of cat01.
My query is that I want to populate a simple HTML <SELECT> menu (using ASP),
but instead of it being a straightforward 'select catid from stockcats order
by catid', I want to group this list into some kind of order, eg:
instead of:
cat01 <nothing> << I need to bring back this 2nd column so that I can
do a simple IF THEN in asp to indent sub-cats
cat02 <nothing>
cat03 cat01
cat04 <nothing>
cat05 cat01
cat06 cat02
cat07 cat04
I would like
cat01 <nothing> << ditto
cat03 cat01
cat05 cat01
cat02 <nothing>
cat06 cat02
cat04 <nothing>
cat07 cat04
Do you know if this is possible in pure SQL (I must confess that I'm using
MySQL, but I would have thought the SQL syntax would be the same if it is
possible) or a combo of ASP & SQL?
Thanks
Robbie
View 3 Replies
ADVERTISEMENT
Dec 7, 2004
I need to document the port numbers from nearly 120 sql servers in the network. Is there any query that I can use to get this info??
Thanks,
View 13 Replies
View Related
May 28, 2008
All- I would greatly appreciate some assistance in creating a SELECT statement for table headcount in the following problem:
First, find the schema here: http://home.pacbell.net/eulimi/schema_headcount.GIF
The problem:
Given a person_id (a record in the person table), list all headcount records WHERE:1) headcount.person_id = person.person_id AND2) the headcount.act_session_id belongs to a activity (from the activity_session table) that the person is allowed to attend by virture of the person's membership in a subexpedition.
Note that:
- A person can be a member of one or more circles (via the circle_person table)- Each circle belongs to exactly one subexpedition.- A persons who is a member of a subexpedition (via one or more circles) is entitled to sign up for one or more activities (activity_sessions) associated with the subexpedition.
So, put yet another way, the SELECT command should show, for a given person_id, the list of records in headcount that includes the activities (act_session_id) that the person is entitled to join by virtue of the persons membership in the subexpedition via his circle. (Whew!)
I hope this is enough information. I think the problem would be fun if I knew what I was doing. (SQL newbie here.) I suspect I need several INNER JOINs and a compound WHERE clause.
Thanks in advance!!!
View 5 Replies
View Related
Nov 26, 2007
Hi,
If I query like this, am getting the following Output.. Why is the part before '_ ' gets truncated and gets displayed as result ?
SELECT 10_to_100
_to_100
-----------
10
SELECT 25_from
_from
-----------
25
If anybody is familiar with the reason,pls share...
cheers !
ash
View 5 Replies
View Related
Oct 26, 2007
Hi friends
this is the Orders to rise the publisheres (Titles or magzines).
I have two tables
1) orders Tables the columns are like orderno int , titleId int ,ItContaincomb bit, combinationID int.
Values(1,2,null,null)
values(1,3,null,null)
values(2,4,null,null)
Values(2,3,null,null)
values(2,2,null,null)
values(3,4,null,null)
2) CombinationTable containg columns like CombId int , Titleid int.
values(101,2)
values(101,3)
values(102,4)
values(102,5)
valus(103,2)
values(103,4)
my requirement is in orders table the last twocolumns should be filled by checking the combination table
1)
take 101 combination containg 2,3 titles check these all titles are containg or not . if Compulsory all titles containg means in orders table we put
ItContaincomb true, combinationID 101 for all containg titles.
if not containg single title in orders table for combination 101 means
we put that titleid rows should containg column of ItContaincomb is false and combid is 0.
i want below out put for above two tables how to write a query or how to use all function.
the output is (in orders table)
Values(1,2,true,101)
values(1,3,true,101)
values(2,4,false,0)
Values(2,3,false,0)
values(2,2,true,103)
values(3,4,true,103
please help me .
thanks regards
venkat
View 3 Replies
View Related
Oct 2, 2007
The value in the table of one DB is 17869 sq. ft. Now to insert this value in a new table of other database the reporting basis is 1000 i.e I need to do 17869/1000 = 17.8 so I have to take the value as 18. Another thing to be kept in mind is the value in the new table should have leading Zeroes. If the value is 18 it should be displayed as 0000018 ( data type in new table is Varchar(7) and in old table char (9) ). What can be the best way to implement this??
View 8 Replies
View Related
Mar 5, 2007
Hi Everyone,I'm drawing a blank here and I am hoping someone can point me in the right direction. I have a table with the following columns (some omitted)IDGUIDPageNameParentPageID I want to build a hierarchical navigation system (2-tier). The conceptual problem that I am running into was getting this information from the same table. Initially I was going to use a nested repeater but I am thinking a treeview would be better. Anyway, the problem is the query. How would I start with something like this? Let's use the following as an exampleRows(ID '1', GUID '888....', PageName 'Page A', ParentPageID '-1')(ID '2', GUID '111....', PageName 'Page B', ParentPageID '-1')(ID '3', GUID '222....', PageName 'Page C', ParentPageID '-1')(ID '4', GUID '375....', PageName 'Page 1', ParentPageID '1')(ID '5', GUID '562....', PageName 'Page 2', ParentPageID '1')(ID '6', GUID '874....', PageName 'Page 3', ParentPageID '2')
(ID '7', GUID '388....', PageName 'Page 4', ParentPageID '3') So, I want to be able to build a query so that I can do the followingPage A Page 1 Page 2Page B Page 3Page C Page 4 Any help would be greatly appreciated. Thanks!
View 4 Replies
View Related
Mar 12, 2013
Information stored within the database is as follows, although the number of sub levels could easily grow :
PageID - Title - ParentID
1 - Title1 - 0
2 - Title2 - 0
3 - Title3 - 1
4 - Title4 - 1
5 - Title5 - 4
Required outcome :
[+] Title1
.....[+] Title3
.....[+] Title4
..........[+] Title5
[+] Title2
View 3 Replies
View Related
Jul 29, 2004
Hi,
I have a below Oracle query :
UPDATE test1 a SETa.sno = 3
I need the equivalent SQL Server query for the above along with with alias name 'a' set for the table test1. Please advise.
Thanks,
Sam
View 3 Replies
View Related
Feb 8, 2008
Not sure if this is possible, but maybe. I have a table that contains a bunch of logs.
I'm doing something like SELECT * FROM LOGS. The primary key in this table is LogID.
I have another table that contains error messages. Each LogID could have multiple error messages associated with it. To get the error messages.
When I perform my first select query listed above, I would like one of the columns to be populated with ALL the error messages for that particular LogID (SELECT * FROM ERRORS WHERE LogID = MyLogID).
Any thoughts as to how I could accomplish such a daring feat?
View 9 Replies
View Related
May 17, 2008
Hi
I am looking to buy an SQL server2005 with 5 CAL's for my company in UK to fulfill our database management requirements. There seems to be a big difference between the US and UK prices. The US prices are somewhere around half the price of what i could get in UK. Are there any tax implications if i order one from US. Would there be any problems of registration if i buy from US. Any answers would be greatly appreciated.
I need to order them asap.
Thanks
View 1 Replies
View Related
Sep 6, 2006
Hi, not exactly too sure if this can be done but I have a need to run a query which will return a list of values from 1 column. Then I need to iterate this list to produce the resultset for return.
This is implemented as a stored procedure
declare @OwnerIdent varchar(7)
set @OwnerIdent='A12345B'
SELECT table1.val1 FROM table1 INNER JOIN table2
ON table1. Ident = table2.Ident
WHERE table2.Ident = @OwnerIdent
'Now for each result of the above I need to run the below query
SELECT Clients.Name , Clients.Address1 ,
Clients.BPhone, Clients.email
FROM Clients INNER JOIN Growers ON Clients.ClientKey = Growers.ClientKey
WHERE Growers.PIN = @newpin)
'@newpin being the result from first query
Any help appreciated
View 4 Replies
View Related
Jan 22, 2008
i HAVE one requirement in a table. that is column1 for first record value 100next record 101next record 102next record 103for next 104I want to update that table daily with this requirement.not with identity columnnext day 100 may be 220,339, some thing random numberlike this how can i update a table column1
View 2 Replies
View Related
Jan 24, 2005
Hello,
Anyone aware of any license requirment for selling any application developed in ASP.NET (C#) using MSDE as backend?
Any response will be highly appreciated.
Thanks
View 5 Replies
View Related
Apr 24, 2003
Windows 2003 came in the market already.
Yukon is going to release soon.
Will SQL Server 2003 run better on Windows 2000 Server, or it will run better on Windows Server 2003?
Anybody know?
View 1 Replies
View Related
Jul 15, 2004
How do you create a php or html page with a drop down menu from a table a database? Please show any code or helpful links,
Thanks!
View 1 Replies
View Related
Jun 10, 2008
Hi Experts ,
I want to insert datas randomly to all columns of a table.The columns have different datatypes like int,varchar,datetime. What to do??? It is urgent so please help.
TIA
RKNAIR
View 6 Replies
View Related
Jul 20, 2005
Hi,As subj says. A simple menu is defined in a table. But how to extract it?Heres the deal:Table menu has these 3 columns: menuid parent menudescOk this should be easy right? Those menu-rows that has parent=0 is"toplevel". And so forth. An example:1 0 "Items"2 0 "Standings"3 0 "Test"4 2 "Liverpool"5 2 "AC Milan"6 1 "Itemno1"This menu should in layout come in this order:ItemsItemno1TestStandingsAC MilanLiverpoolThat is: Alphabetically sorted and with the children underneath the parents.Right? Yes - and selecting the menu and doing some gymnastics in ASP isntthat hard. But ASP must be the language that has the "crapiest" way ofhandling arrays...so a simple task is really messy. Creating a storedprocedure involes 2-3 temporary tables as I see it. Not vey elegant either.So my question is: Isnt there any way of selecting this order directly usingSQL?? Some nice clean and beautiful way?--Thanks,Summa
View 2 Replies
View Related
Dec 26, 2007
Is there any recommendation of how to calculate what would be a suitable hardware requirement for running a huge database on Production. I have a database with over 150GB of data. The server has 1.5GB memory. The database is indexed. The size of the database will most probably exceed over 400GB of data. Is there any recommendation on how much memory / hardware to put on the box.
Also on a side topic, how do large sites (example - microsoft forum) keep storing information in a database and still allow fast searching? Do they move old info to another database... But I am able to search across old information as well.
View 5 Replies
View Related
Sep 27, 2007
Hello, this is Subhani .
I am installing Sql 2005 standard version.
The problem is that while I am installing Sql 2005 the two warning messages are given that €ścom plus catalog requirement€? & €śminimum hardware requirement€? So please suggest me, what I have to do to install successfully
View 2 Replies
View Related
Jul 17, 2007
Hi experts,
We have SQL Server 2005 installed in MS Windows server 2003 with 8 GB RAM. This server has 4 processors.
Ours is a VLDB and a single table has 400 million records occupying nearly 40 GB of space.
We find it vert difficult to meet the response time set by the clients in many occasions.
Should the RAM be atleast as big as the biggest table in the database ? Is this mandatory ?
Even any other suggestions for improving the performance are welcome.
Thanks & Regards,
Hariarul
View 4 Replies
View Related
Jun 23, 2005
I followed an article which was recently published by Jeff Prosise in his "Wicked Code" column in MSDN magazine and I was able to make it work.My problem is that I do not know how to refresh the menu. If I add new record in the sitemap table what needs to happen to refresh the menu.
View 2 Replies
View Related
Sep 30, 2005
Hello,I am upgrading my (simple) cms from one menu layer to two layers. So i have two tables in de my DB- table_mainmenu- table_submenuThe submenu records are linked to the mainmenu records on the mainmenu id. So far so good. Heres my problem, i cant figure out how to change the order of the pages...!? What is the theory behind recording the stacking order of the menu items? How can i record this information in the DB?I just need the theory, i can figure out the details for myself. Thanks in advance!Corstiaanp.s. is the the right forum to post this?
View 4 Replies
View Related
Jun 28, 2004
Hi,
I am not even sure where and what to do on this requirements
"If the system crashes before all the information during transaction fails, none of those changes will be saved to the database."
what kind of info you need from my DB?
no clue.
thanks
View 1 Replies
View Related
Mar 29, 2014
How do I get a distinct value of menu from tables
Here is my script
select distinct menu, others, clientele,menuID from myrestaurant where username = 'mary' and batch = 238335
View 4 Replies
View Related
Apr 5, 2006
hi all,
I have a table called suppliers where i type my suppliers details.
I have also a table called supp_corellation in which i have the proffesion of my suppliers.
there is one column in the table of suppliers which it takes data from the table supp_corellation . Is it possible to choose the values from a list instead of typing in my table (lets say drop down list)???
View 3 Replies
View Related
Jun 12, 2006
Hi
is there any way of getting the values of a row in a table to be reflected as the values of a drop down menu?
View 2 Replies
View Related
Sep 18, 2007
Hello there
I installed sql server 2005 developer edition
and the only error message i got was.
- IIS Feature Requirement (Warning)
Messages
IIS Feature Requirement
Microsoft Internet Information Services (IIS) is either not installed or is disabled. IIS is required by some SQL Server features. Without IIS, some SQL Server features will not be available for installation. To install all SQL Server features, install IIS from Add or Remove Programs in Control Panel or enable the IIS service through the Control Panel if it is already installed, and then run SQL Server Setup again. For a list of features that depend on IIS, see Features Supported by Editions of SQL Server in Books Online.
how do i get hold of Internet Information Services
I installed it on vista premium.
Please help
Regards
ROB
View 3 Replies
View Related
Mar 13, 2008
Hello, I need permission to work with SQL jobs on particular sever, currently I'm not able to see SQL agent menu.
What permissions should i need to have to view SQL Agent Menu.
Please some one help in this.
Thanks,
Malathi.
View 3 Replies
View Related
May 20, 2006
We are running four servers at different sites say A,B,C and D and wantit to connect main Server at head office what would be theconfiguration of main server for running SQL Server 2005.There are twodatabase say X and Y at each server at sites A,B,C and D. X requires37.4 MB memory while Y requires 154 MB memory. 500 records arepopulated in X database at each site While 30000 records are populatedin Y database at each site. What would be HW requirement for SQLServer?With regardsAli Raza Rajput
View 2 Replies
View Related
Jun 21, 2007
Hi, I read throught the requirements of installing SQL Express and found that one of the requirement stated Microsoft .NET Framework. As I'm now developing my application in VC++(MFC), it's not build on .NET Framework. I wish to know in my case, can I use SQL Express in my application? Thank in advance.
View 4 Replies
View Related
Apr 24, 2006
I am in the process of learning SQL from scratch and figure it would be helpful if I can run a local server and experiment with it as I move along some book reading. I have a few questions regarding the operating system requirement for running a localhost server and hope some of you can answer to my novice questions. Can I setup a server under Windows XP? when I looked thru the documentation it indicated only windows 2000 and other Microsoft server OS will support a SQL server setup. Why then it also indicate XP as compatible? Is it because it's compatible as a client? If I do have to run a server under a different operationg system, what is the best approach for setting up another server on my only PC system along with my XP. Thanks for any answers and comments in advance.
View 7 Replies
View Related
Jun 8, 2007
I have developed a client server application using SQL Server 2005 Express and VB.Net. I will be distributing it to my customers. I am putting together a System Requirement document. I am wondering what kind of Server (o/s) and network configuration customers need to have. I know they cannot use a pier to pier network setting. What kind of network setting do they need to have? Does the server machine need to have a server o/s (such as Win 2003 Server) or is Windows XP fine? Any help will be appreciated.
View 3 Replies
View Related