Jul 26, 2008

All Database Query - MySql, Sql Server, All Database Talk!

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Others

free web hosting

All Database Query - MySql, Sql Server, All Database Talk!

khmerneed
Dear All Friends!

I have create this topic for everyone who have some problem with query analyses. You could post all your problem with database. We all would have and find a solution for you.

Now let me start my small problem. This i have fixed but i just think of the best way.

I got 3 tables:
table_users (user_id,user_name,user_pass,user_group)
table_group (group_id,group_name)
table_usersingroup (ursingro_id,user_id,group_id)

I need output like this:

username | password | group
test1 | ***** | (group1,group2,group3)
test2 | ****** | (group2,group3)
test3 | **** | (group1,group2,group3,group4)

I hope anyone may solve this problem

Thanks & Best Regards,
Dorei biggrin.gif

Reply

sandymc
well, khmer, i cant understand ur question, what ur mean the output will be? do you have already all instances and foreign key connected to each database?, i'm currently learning database management sytem in my coputer science course...

Reply

khmerneed
Well, I already build up a relationship, as you may have seen, primarykey and foriegnkey.

the output is the data which we need back... for input we are exactly know as well
when put

box: username
box: password
slect: groups (multiselect)

so, it would be
TABLE table_user

USERID | USERNAME | PASSWORD
1 | test1 | *****
2 | test2 | *****
3 | test3 | *****

TABLE table_group

GROUPID | GROUPNAME
1 | Group1
2 | Group2
3 | Group3
4 | Group4

TABLE table_ursingro

URSINGROID | USERID | GROUPID
1 | 1 | 1
2 | 1 | 2
3 | 1 | 3
4 | 2 | 2
5 | 2 | 3
6 | 3 | 1
7 | 3 | 2
8 | 3 | 3
9 | 3 | 4

I hope you make sence now...

So, the out put which we need is:

username | password | group
test1 | ***** | (group1,group2,group3)
test2 | ****** | (group2,group3)
test3 | **** | (group1,group2,group3,group4)

Thanks & Best Regards,
Dorei

 

 

 


Reply

LuciferStar
select table_users.username,table_users.user_pass,table_group.group_name
where
table_useringroup.user_id=table_users.user_id
and table_usersingroup.group_id = table_group.group_id

this code may help you to find out the right result, but when you output the result,you need to deal with the result,in order to get such result:
test1 | ***** | (group1,group2,group3)
that is,all the group name in one record.

Reply

khmerneed
Yes, that is what i am trying.
Anyway i wonder if anyone have other way which is far better than this.

O.K Anyway i wish all members which attend or have some problem with SQL, you may post here, so share the problem solving.



Thanks & Best Regards,
Dorei

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : database query mysql sql server database

  1. Learning Mysql - pls guide (3)
    hello out there, i have already looked through on this tutorial forum.. and still can find any
    topics which related to MySql basic.. i wanna learn about how to create MySql table and its
    concept!! just basic.. i've no knowledge on MySql before nor any other database server
    software.. but i do have littol konwledge on programming,scripting,html basic in concept.. pls dun
    gave me so many links so as i can be blur for none about how to get start!! /laugh.gif'
    border='0' style='vertical-align:middle' alt='laugh.gif' /> i can thou find from Googles sear...
  2. Baby Web Server (asp) - (3)
  3. Ipb Mysql Probelm - (1)
    hi im having problem with my IPB database when ever somone submits a post i get this error message
    IPS Driver Error CODE mySQL query error: UPDATE trap17_ipbmembers SET points=points+ WHERE
    id=1 SQL error: 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 'WHERE id=1' at line 1 SQL error
    code: Date: Saturday 15th of April 2006 09:49:46 AM can somone please explain
    to me what is wrong? use code tags where appropriate. fixed. ...
  4. Mysql... - and its limits? (11)
    I haven't been able to try out any mysql databases, but is more than one really required?
    I'm looking at most hosts and most offer unlimited mysql databases. Shouldn't one database
    be enough? I would guess one can hold several kinds of information in sub-databases, maybe?...
  5. Mysql: What Do I Do First? - (3)
    I know SQL statements and a little PHP. I want to create an online database and a friend gave me
    this cd with tutorials on PHP and MySQL development. I'm lost in all these deleting user,
    setting privileges part. Can anyone make me understand these things better? /blink.gif'
    border='0' style='vertical-align:middle' alt='blink.gif' /> ...
  6. Installing Apache,mysql And Php In Windows - Good text for beginners (4)
    Here it is the text i have found in CODE http://www.jevontech.com/ , and i'm posting
    this text because i remember the dificults i had when i wanted to do this right... Installing
    Apache , MySQL and PHP under Windows Introduction While many webservers run Linux, Unix or BSD most
    personals computers run on Windows. So it would be quite comfortable if web designers and
    developers could develop on their home computer.So in this E-book we will focus on configuring your
    computer to use Apache, MySQL and PHP, so you can work on your home computer. Step 1: Ins...
  7. Mysql - Any help?.. (7)
    Alright, well. Let's face it, I can understand PHP, but MySQL seems like... Chinese to Japanese.
    Korean to Vietnamese. Totally different, but looks the same to some. Anyway, I was wondering.. Are
    there any understandable tutorials out there that involve php? WebMonkey confuses me (@_@) I'll
    be eternally in your debt. Edit: It seems I can understand MySQL fairly okay, it's phpMyAdmin
    that confuses me. /laugh.gif' border='0' style='vertical-align:middle' alt='laugh.gif' /> -
    Zenchi Discalimer: I'm a liar....
  8. Installing A Server On Linux?, Doesn't Seem To Wor - (0)
    I've been trying to install a server on my Mankdrake 10 linux distro machine, but it has failed.
    I followed a book, I followed several "install mysql" tutorial stuff and it doesn't seem to
    work. I am new to linux and I have never had even an RPM work on this computer. Its not a slow
    computer, but it runs a 1.7g Intel Celeron, 300+ Ram (256 + 128), built in graphics and sound -
    sound doesn't work, and screensavers are slow as hell. I think the os has lots a problems with
    the hardware (duh), and I'm not sure where to get drives (not that ill be able to use...



Looking for database, query, mysql, sql, server, database, talk

Searching Video's for database, query, mysql, sql, server, database, talk
advertisement



All Database Query - MySql, Sql Server, All Database Talk!



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE